mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
fix: disposing workspace comments. (#7264)
* fix: disposing workspace comments. * whitespace formatting
This commit is contained in:
@@ -144,8 +144,6 @@ export class WorkspaceCommentSvg
|
||||
}
|
||||
|
||||
dom.removeNode(this.svgGroup);
|
||||
// Dispose of any rendered components
|
||||
this.disposeInternal();
|
||||
|
||||
eventUtils.disable();
|
||||
super.dispose();
|
||||
@@ -989,11 +987,6 @@ export class WorkspaceCommentSvg
|
||||
this.resizeComment();
|
||||
}
|
||||
|
||||
/** Dispose of any rendered comment components. */
|
||||
private disposeInternal() {
|
||||
this.disposed_ = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the focus on the text area.
|
||||
*
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
goog.declareModuleId('Blockly.test.workspaceComment');
|
||||
|
||||
import {WorkspaceComment} from '../../build/src/core/workspace_comment.js';
|
||||
import {
|
||||
sharedTestSetup,
|
||||
sharedTestTeardown,
|
||||
@@ -166,6 +165,19 @@ suite('Workspace comment', function () {
|
||||
// Nothing should go wrong the second time dispose is called.
|
||||
comment.dispose();
|
||||
});
|
||||
|
||||
test('WorkspaceCommentSvg disposed', function () {
|
||||
const comment = new Blockly.WorkspaceCommentSvg(
|
||||
this.workspace,
|
||||
'comment text',
|
||||
0,
|
||||
0,
|
||||
'comment id'
|
||||
);
|
||||
comment.dispose();
|
||||
// Nothing should go wrong the second time dispose is called.
|
||||
comment.dispose();
|
||||
});
|
||||
});
|
||||
|
||||
suite('Width and height', function () {
|
||||
|
||||
Reference in New Issue
Block a user