fix(tests): Make test imports correct and more consistent (#7260)

* fix(tests): Fix invalid import paths in mocha tests

  This resolves the warnings generated during buildDeps by
  closure-make-deps.

  This commit does not attempt to address #7224 or otherwise
  rationalise the imports and usage thereof.

* fix(tests): Fix failing context menu item test

  Test appears to have been wrong: Block.prototype.getIcon is typed
  as

      getIcon<T extends IIcon>(/* ... */): T | undefined

  and documented as "@returns The icon with the given type if it
  exists on the block, undefined otherwise."

* refactor(tests): Clean up inconsistent usage of CommentIcon

  Tweak the test files touched by PR #7200 to be consistent with
  existing usage of Blockly.icons.CommentIcon instead of importing
  this separately.
This commit is contained in:
Christopher Allen
2023-07-07 17:15:03 +01:00
committed by GitHub
parent 07ba841850
commit aefb97d780
5 changed files with 20 additions and 22 deletions

View File

@@ -10,7 +10,6 @@ import {
sharedTestSetup,
sharedTestTeardown,
} from './test_helpers/setup_teardown.js';
import {CommentIcon} from '../../core/icons/comment_icon.js';
import {simulateClick} from './test_helpers/user_input.js';
suite('Comment Deserialization', function () {
@@ -62,8 +61,7 @@ suite('Comment Deserialization', function () {
const icon = block.getIcon(Blockly.icons.CommentIcon.TYPE);
icon.setBubbleVisible(true);
// Check comment bubble size.
const comment = block.getIcon(CommentIcon.TYPE);
const bubbleSize = comment.getBubbleSize();
const bubbleSize = icon.getBubbleSize();
chai.assert.isNotNaN(bubbleSize.width);
chai.assert.isNotNaN(bubbleSize.height);
chai.assert.equal(icon.getText(), text);