Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Utilize getIcon instead of getCommentIcon in tests #7200

Merged
merged 3 commits into from
Jun 23, 2023

Conversation

itsjayway
Copy link
Contributor

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide
  • I ran npm run format and npm run lint

The details

Resolves

Fixes #7164

Proposed Changes

utilize getIcon() in preparation for v11

Behavior Before Change

image

Behavior After Change

image

Reason for Changes

The mocha tests are currently outputting deprecation warnings to the console because of calls to getCommentIcon. (#7164 (comment))

Test Coverage

npm run test:mocha:interactive -> check console

Documentation

Removed deprecation function, docstring, and dependencies from block_svg.ts

Additional Information

N/A

@itsjayway itsjayway requested a review from a team as a code owner June 23, 2023 06:38
@itsjayway itsjayway changed the title Remove get comment icon in tests fix: Remove get comment icon in tests Jun 23, 2023
@github-actions github-actions bot added the PR: fix Fixes a bug label Jun 23, 2023
@itsjayway itsjayway changed the title fix: Remove get comment icon in tests fix: Utilize getIcon instead of getCommentIcon in tests Jun 23, 2023
@github-actions github-actions bot added PR: fix Fixes a bug and removed PR: fix Fixes a bug labels Jun 23, 2023
Copy link
Collaborator

@BeksOmega BeksOmega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, this looks great :D Just one fixup and then this should be good to go!

core/block_svg.ts Outdated Show resolved Hide resolved
@BeksOmega BeksOmega requested review from BeksOmega and removed request for rachel-fenichel June 23, 2023 15:07
@BeksOmega BeksOmega merged commit 1174777 into google:develop Jun 23, 2023
@itsjayway itsjayway deleted the removeGetCommentIconInTests branch June 23, 2023 18:22
@@ -10,6 +10,7 @@ import {
sharedTestSetup,
sharedTestTeardown,
} from './test_helpers/setup_teardown.js';
import {CommentIcon} from '../../core/icons/comment_icon.js';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should have been from '../../build/src/core/icons/comment_icon.js' (here and below).

We are now seeing build warnings that I believe are due to this; I'm actually not certain how this test is running successfully as I would not expect the import as written to work at all:

Could not find "../../core/icons/comment_icon.js".Assuming it (and its transitive dependencies) are non-Closure managed. /Users/cpcallen/src/blockly/tests/mocha/comment_deserialization_test.js
Could not find "../../core/icons/comment_icon.js".Assuming it (and its transitive dependencies) are non-Closure managed. /Users/cpcallen/src/blockly/tests/mocha/contextmenu_items_test.js
...

cpcallen added a commit to cpcallen/blockly that referenced this pull request Jul 7, 2023
Tweak the test files touched by PR google#7200 to be consistent with
existing usage of Blockly.icons.CommentIcon instead of importing
this separately.
cpcallen added a commit that referenced this pull request Jul 7, 2023
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove calls to getCommentIcon in tests
4 participants