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

Migrate core/utils/toolbox.js to goog.module syntax #5076

Merged
merged 6 commits into from
Jul 20, 2021

Conversation

alschmiedt
Copy link
Contributor

@alschmiedt alschmiedt commented Jul 15, 2021

The basics

  • I branched from goog_module
  • My pull request is against goog_module
  • My code follows the style guide
  • My code is presented in the form suggested in the module
    conversion guide
  • I have run npm test locally already.

The details

Resolves

Part of #5026

Proposed Changes

Converts core/utils/toolbox.js to goog.module syntax.

Additional Information

This is failing this test case. It is because Blockly.utils.toolbox.parseToolboxTree !== parseToolbox. I'm not entirely sure what to do about this. I tried updating the test, but couldn't find a way to require the module with the current set up.

@alschmiedt alschmiedt requested a review from a team as a code owner July 15, 2021 20:05
@alschmiedt alschmiedt requested a review from cpcallen July 15, 2021 20:05
@cpcallen cpcallen added this to the 2021_q3_release milestone Jul 16, 2021
@cpcallen cpcallen changed the title Migrate utils toolbox Migrate core/utils/toolbox.js to goog.module syntax Jul 16, 2021
Copy link
Contributor

@cpcallen cpcallen left a comment

Choose a reason for hiding this comment

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

I've tweaked the PR title for consistency.

Overall looks good, but the test failure will need to be sorted before merging.

I'm not sure what the best way to do this is: moving to properly encapsulated modules makes the kind of monkey patching that I presume the test is doing no longer work, unfortunately.

core/utils/toolbox.js Outdated Show resolved Hide resolved
tests/deps.js Outdated Show resolved Hide resolved
tests/deps.js Outdated Show resolved Hide resolved
core/utils/toolbox.js Outdated Show resolved Hide resolved
core/utils/toolbox.js Outdated Show resolved Hide resolved
tests/deps.js Outdated Show resolved Hide resolved
@cpcallen
Copy link
Contributor

Any luck figuring out how to modify the tests?

@alschmiedt
Copy link
Contributor Author

No, not yet. I think the correct way is to import the module (reference here), however we would then have to convert our tests to use goog.module which we can't load in index.html through a scripts tag. You mentioned looking at the blockly_uncompressed.js file, but I have a few questions before moving on.

@cpcallen cpcallen assigned alschmiedt and unassigned cpcallen Jul 20, 2021
@alschmiedt
Copy link
Contributor Author

Removed the test since it should probably be in a separate test suite with the rest of Blockly.utils.toolbox. Filed issue #5139 to track.

Copy link
Contributor

@cpcallen cpcallen left a comment

Choose a reason for hiding this comment

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

Seems like a reasonable solution.

@alschmiedt alschmiedt merged commit be76e03 into google:goog_module Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants