* Add tests for saving extra state
* Add serializing extra state
* Fix backwards compatibility
* Switch to other function declarations
* Handle null returns from hooks
* Remove backwards compatibility
* Remove XML require, and fix type
* Fix JSDoc formatting
* Add basic attribute tests
* Add basic block serialization
* Add more attribute tests
* Change save to use options dictionary
* Add obeying save options
* Add test for data attribute
* Add saving data tag
* Move to ES6 syntax
* Fixup move to es6 syntax
* Declare module
* Format and lint
* Add docs
* Add returning null on insertion markers
* Fixup for move to module
* Switch to other function declarations
* Cleanup for finalized style
* Fix lint and types
* Export State def
* Switch disabled=true to enabled=false
* Add JSON serialiation hooks for fields
* Add checking for JSON hooks
* Fix other checks and move checks to function
* Remove error for both serialization hooks being defined
* Fixup comments and errors
* Add tests
* Add json hooks to block properties
* Cleanup
* Rip out fragile backwards compatibility
* Setup basic architecture for tests
* Attribute tests
* Easy field tests added
* Work on tests
* Work on tests
* Work on tests
* Add mutation tests
* Fixup ID tests
* Add more mutator tests
* Fixup lint and typos
* Uncomment tests
* Use test helpers
* Small PR comments
* Use test helpers for setup and teardown
* Add TODOs and fixup types
* Fix types
* Actually fix types
Since the only part of the Closure Library we have is base.js,
prevent it from trying to load deps.js from the same directory.
(We already load our own dependency graph from tests/deps.js.)
* Migrate core/blockly.js to ES6 const/let
* Migrate core/blockly.js to goog.module
* Migrate core/blockly.js to named requires
* clang-format core/blockly.js
* Consolidate accessors in core/blockly.js
* Add getSelected/setSelected to core/common.js
* Migrate core to use Blockly.common.getSelected/setSelected instead of Blockly.selected
* Migrate demos to use Blockly.common.getSelected/setSelected instead of Blockly.selected
* Remove Blockly.selected
* Use variable instead of calling common.getSelected() multiple times
* Add accessor for selected on Blockly
* Add renaming record for Blockly.selected -> Blockly.common.getSelected/setSelected
* Use Object.defineProperties instead of .defineProperty when
installing get and set accessors for previously-mutable exports.
* Add entries to renamings.js where feasible (i.e., for static rather
than instance properties).
(Don't do blockly.js yet, to avoid merge conflicts.)
* Use goog.module in mocha tests
* Fix compiler warnings
* Make test helpers a module
* Name test modules Blockly.test.*
This is to be more consistent with how non-test modules are named.
Also remove top-level goog.require of TestHelpers (now
Blockly.test.helpers) since requiring a side-effect-less module does
nothing.
* Convert block_test.js and comment_test.js to goog.module syntax
* Address PR comments
* Goog modulify tests
* Goog modulify toolbox helpers
* Fixes imports and moves common tests from workspace_test.js to a helper file.
* Update test deps after rebase
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
* Reexport Blockly.utils.* modules from Blockly.utils
* Update metadata (file sizes) again
blockly_compressed.js has gotten too big for the second time this
quarter. Update the expected file sizes for it so that tests
will continue to pass.
* Add hideChaff() to core/workspace_svg.js
* Mark Blockly.hideChaff as deprecated
* Update uses of Blockly.hideChaff() to WorkspaceSvg.hideChaff() in core
* Update uses of Blockly.hideChaff() to WorkspaceSvg.hideChaff() in demos
* Style and formatting fixes
* Switch from accessor to stub wrapper for Blockly.hideChaff
Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
* Move bump objects function into a separate module
* Fix types
* Migrate core/inject.js to ES6 const/let
* Migrate core/inject.js to goog.module and move more functions to bump_objects.js
* Migrate core/inject.js named requires
* clang-format core/inject.js
* Rename private functions
* Move hueToHex to core/utils/colour.js
* Mark Blockly.hueToHex as deprecated and pass calls through to Blockly.utils.colour.hueToHex
* Migrate core to use Blockly.utils.colour.hueToHex
* Migrate demos to use Blockly.utils.colour.hueToHex
* Move bump objects function into a separate module
* Fix types
* Update core/bump_objects.js
Fix missing newline.
Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
* Migrate prompt/alert/confirm to dedicated module
* Update core/blockly.js to pass through calls to prompt/alert/confirm to core/dialog.js
* Update calls to Blockly.prompt/alert/confirm to dialog.prompt/alert/confirm
* Fix typo and errant redeclaration of Blockly.prompt
* Clarify JSDoc on customizing Blockly.dialog.alert/confirm/prompt
* Migrate core/utils/xml.js to ES6 const/let
* Migrate core/utils/xml.js to goog.module
The document() function is renamed to getDocument() so as to avoid
shadowing the global of the same name.
* clang-format core/utils/xml.js
* Call monkey-patchable exports.global internally too
This fixes Node test failures due to the monkey-patching of
Blockly.utils.xml.global in scripts/package/node/core.js not being
able to affect the target calls in createElement and createTextNode.
This is part of #5153 but is being prioritised because we want remove
the declareLegacyNamespace calls from the core/utils/*.js modules and
then reexport them explicitly via utils.js, and it turns out that
doing so results in the exports object of this module being passed to
Object.freeze - which fails on the global object, which can't be made
non-extensible!
The new name chosen for the former default export is globalThis, since
it is intended to have the same value as the global variable of that
name; see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
Running npm run build:deps in goog_module makes a change to tests/deps.js that was previously committed by PR #5441 but which appears to have been inadvertently undone by #5222.
* Migrate core/tooltip.js to ES6 const/let
* Migrate core/tooltip.js to goog.module
* Migrate core/tooltip.js to named requires
* clang-format core/tooltip.js
* Fix exports of mutable fields in core/tooltip.js
* Don't assign a value when exporting visible in core/tooltip.js
Some files were using Blockly.utils.object.inherits (or .mixin) without
having imported Blockly.utils.object.
Similarly, trashcan.js tried to use utils.Size as a constructor
instead of importing Size from Blockly.utils.Size.
Create a file scripts/migration/renamings.js to collect information about renamed API entries. Start by filling it with the renamings already done to blockly.js.
* Migrate core/events/events.js to ES6 const/let
* Migrate core/events/events.js to goog.module
* Migrate core/events/events.js to named requires
* clang-format core/events/events.js
* Migrate Blockly core to use getRecordUndo/setRecordUndo
* Update core/events.js to reflect latest guidance around exporting mutable fields