Skip to content

Conversation

rschamp
Copy link
Contributor

@rschamp rschamp commented Feb 16, 2017

Resolves

For scratchfoundation/scratch-gui#16

Proposed Changes

Provides a method to transform Blockly toolbox XML to only contain blocks which the VM can handle. It does this by removing any blocks in the toolbox for which it does not have a registered opcode.

Reason for Changes

We need this method so that we can strip a given toolbox to only the blocks that the VM is capable of running. This is a temporary solution until we have a way to generate the toolbox based on the editing target.

Test Coverage

I would like to include tests, but I didn't want to require jsdom or a similar DOM-simulating library just for this one hacky method... Any suggestions for a lighter DOM-mocking method would be appreciated!

I considered the possibility that the fact that I would need to include a library to test this may indicate that I'm putting this method in the wrong place. However, given the other parts of the VM that interact with Blockly, this seems like the right place for now.

@rschamp rschamp added this to the February 15 milestone Feb 16, 2017
@rschamp rschamp requested a review from cwillisf February 16, 2017 00:36
@rschamp rschamp changed the title Pro Provide method for filtering toolbox XML Feb 16, 2017
@thisandagain
Copy link
Contributor

This looks good in terms of functionality. For testing I actually wouldn't be opposed to adding jsdom to handle this kind of thing, but it does make our devDependencies significantly heavier.

@cwillisf cwillisf removed their assignment Feb 22, 2017
@rschamp rschamp merged commit 343b5bf into scratchfoundation:develop Feb 27, 2017
@rschamp rschamp deleted the filter-toolbox branch February 27, 2017 19:14
rschamp pushed a commit to rschamp/scratch-vm that referenced this pull request Mar 9, 2017
…toolbox"

This reverts commit 343b5bf, reversing
changes made to 370f2c6.
rschamp added a commit that referenced this pull request Mar 9, 2017
* Revert "Merge pull request #486 from rschamp/fix-filter-tests"

This reverts commit ba00db8, reversing
changes made to 739c5de.

* Revert "Show Categories that use custom code to load (variables, procedures) (#483)"

This reverts commit 739c5de.

* Revert "Merge pull request #461 from rschamp/filter-toolbox"

This reverts commit 343b5bf, reversing
changes made to 370f2c6.
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.

3 participants