Commit Graph

118 Commits

Author SHA1 Message Date
Andrew n marshall
9b8704f4bc Adding travis_fold logging around each test (#1879)
Replace individual .travis.yml commands and test_runner.js with tests/run_all_tests.sh, which manages the travis_fold statements and accumulating the output of all the test phases.

This script is now in charge of test_setup.sh (previously handled by npm pretest script). It also adds green/red color coding to each test section, based on success and failure.
2018-05-22 17:23:01 -07:00
Rachel Fenichel
02aada1e3d Make ui events work when block is null; test 2018-05-03 17:36:08 -07:00
Andrew n marshall
0ffd5dda18 Changing root script for tests under Node. (#1837)
* Changing root script for tests under Node.

Was: tests/jsunit/test_runner.js
Now: tests/test_runner.js

The webdriver & jsunit calls formerly in tests/jsunit/test_runner.js
are now in function runJsUnitTestsInBrowser, in
run_jsunit_tests_in_browser.js, called from tests/test_runner.js.

This makes room for additional tests under Node, such as headless and generator tests.
2018-05-02 12:19:49 -07:00
Rachel Fenichel
ee6f2ea097 Comments v3 (#1817)
* Add skeleton for workspace comments

* XML parsing and encoding of workspace comments.

* Minor fix: piping the height and width from xml to newWorkspaceComment

* Move height and width into workspace_comment_svg

* rename newWorkspaceComment to newComment

* minor refactoring. PR changes

* Functions for managing the comment's lifecycle

* Add initial tests

* Add another test

* Add basic rendering of a comment.

* Cleanup remaining highlighting steps from render

* Fix lint

* Fix aslant

* Add basic comment translate

* Simplify render code into one setPath method

* Move steps to setPath_

* Remove svg elements when disposing of a comment; some code cleanup

* Add a workspace comment on context menu click and position it where the initial context menu was clicked.

* Minor rendering changes, fixes RTL. Fix positioning of new (context menu) comments while workspace is scaled.

* PR feedback

* Gesture code for dragging comments

* Add comment (block drag) surface methods

* minor comment fix

* Comment fixes

* Add comment dragger

* Making rendered private

* Require CommentDragger

* Make basic comment dragging work

* Increase the border around the comment to make a bigger drag handle

* Remove typo

* Allow comments to be selected. Highlight selected comment. Only edit comment on click. Updated comment rendering.

* minor refactor: remove commented out code

* PR comments

* lint and rebuild

* Fix renamed function call

* Fix workspace getMetrics by storing comment size as a number, not a string

* Enable comment deletion when dragging over the toolbox or trash can

* Give issue references to some todos

* Create a helper function for workspace comment creation

* Integrate sam's workspace comments, using the bubble dragger

* Remove comment_dragger references

* Remove comment dragger.js

* Remove pointer handling

* Fix lint

* Move comment XML functions into the comment files.

* Fix tests

* Fix type annotations

* Fix comments on comments

* Fix compiler errors related to visibility.

* Fix merge issues and add an issue number to a TODO

* Add a new message for default text on workspace comments, and rebuild

* Add support for a context menu on workspace comment showing delete and duplication options.
Add copy and paste support.

* PR comment feedback

* Show a delete icon on the comment when selected. Delete icon deletes the comment. Comment can be deleted if dragged onto the toolbox or the trash icon. A normal bubble cannot be deleted that way.

* use isDeletable instead

* Support drag of the comment during editing mode using the top handle.

* Add skeletons for all workspace comment events

* Rebuild with new comments

* Get rid of confused TODO

* JSDoc on a function

* Fix broken tests

* More PR feedback

* Fix lint

* Delete comment on mouse out, highlight on mouse down.

* Fix lint.

* Show delete hand cursor when dragging a comment to delete over the toolbox

* Focus textarea on select

* Add delete events

* Remove workspace comment create event, and add TODO placeholder

* Provide default values if comment height and width are missing in XML

* Set comment handle fill to none by default

* Rebuild

* Comment de/serialization should include location.

* Add comment move events, with undo and redo

* Add comment change events

* Move files up to core

* Add package/private annotations wherever possible

* Move the workspace comment events up to core and into a single file

* Mark things package or private where possible

* Get rid of unnecessary changes to messge files

* Fix lint

* Fix some review feedback

* Make changes to the comment db happen in addTopComment and removeTopComment

* Add css classes for toggling comment focus

* Clean up css for comment focus

* Rebuild
2018-04-27 15:18:59 -07:00
Rachel Fenichel
d8202f8cae Create base classes for block and variable events, instead of stuffing everything into Abstract 2018-04-19 16:15:00 -07:00
Rachel Fenichel
23666664fa Fix context menus on blocks with variables 2018-04-12 16:56:07 -07:00
Rachel Fenichel
9a62e6aa70 Merge pull request #1767 from rachel-fenichel/metrics_test
Simple tests for getContentDimensions
2018-04-11 13:41:12 -07:00
Rachel Fenichel
e11ec48ed3 Break tests out into individual cases 2018-04-11 13:35:54 -07:00
Andrew n marshall
ecc41372d7 Fixing issue 1760: nulls in JSON array for block definitions. (#1768)
JSON array with null or undefined value will now skip the offending item, and proceed to load following items. Added tests for null and undefined array elements.

* Testing handling null and undefined id in block definition.
* Adding test utility function to capture console warnings.
* Test assumption that creating a simple block will not cause a warning. This is assumed when later checking warning counts.
2018-04-11 10:22:30 -07:00
Rachel Fenichel
9f07d04709 Simple tests for getContentDimensions 2018-04-09 11:28:18 -07:00
Mark Gibson
54f0e06e21 Customising field types using a register of fields #1584 (#1594)
Implement #1584 - Fields now registered by their JSON type name, allowing new custom fields and overriding of the standard fields. Replaces the manual switch statement for loading fields from JSON block definitions.
2018-02-14 10:14:59 -08:00
Mark Gibson
28d3d68b62 Fix fromJson_ to fromJson in tests 2018-02-07 18:30:22 +00:00
Mark Gibson
d40ef474ae See issue #1486 - adds fromJson_ fn to every Blockly.Field, removing Block.newField*FromJson_ helpers 2018-02-07 12:22:26 +00:00
Rachel Fenichel
4a059b23f8 Add tests 2018-01-29 16:04:47 -08:00
Rachel Fenichel
4c130aab83 Rename createVarBlock to createMockVarBlock, and pass in the workspace as a parameter 2018-01-29 15:15:32 -08:00
Rachel Fenichel
7314bdfb3a Fix #1499 and add some validation 2018-01-17 16:54:12 -08:00
Rachel Fenichel
4cd0b36944 Fix event ordering for variables created from XML implicitly 2017-12-19 14:25:52 -08:00
Rachel Fenichel
6218750207 Fix events for variable fields on new blocks; fix tests 2017-12-19 11:28:23 -08:00
Rachel Fenichel
df1d5ba525 fix tests 2017-12-15 14:07:17 -08:00
Rachel Fenichel
be4054b593 Tests 2017-12-13 11:50:08 -08:00
Rachel Fenichel
399f1a5c11 Tests 2017-12-13 11:50:08 -08:00
Rachel Fenichel
24672bcbb2 Remove ws.updateVariableStore and tests, and ws.getVariableUses 2017-12-13 11:50:08 -08:00
Rachel Fenichel
61db23c78a Get rid of workspace.deleteVariable 2017-12-13 11:50:08 -08:00
Rachel Fenichel
523a10413b All tests pass 2017-12-13 11:50:07 -08:00
Rachel Fenichel
19939dc16a All but XML tests now pass 2017-12-13 11:50:07 -08:00
Rachel Fenichel
3728cfed45 Update tests in workspace_test. Get rid of renameVariable 2017-12-13 11:50:07 -08:00
Rachel Fenichel
c55b6afc6f Fix tests in field_variable_test.js 2017-12-13 11:50:07 -08:00
Rachel Fenichel
779be46a92 Allow variables of different types to share the same name. 2017-12-13 11:50:07 -08:00
Rachel Fenichel
66586bf622 Add a test for case-sensitivity in the variable names, ids, etc. in the flyout 2017-11-03 16:03:32 -07:00
Rachel Fenichel
30716fbd78 switch to variabletype everywhere 2017-11-03 16:03:32 -07:00
Evan W. Patton
67e192e208 Fix logic bugs related to e1e9427 (#1398)
This commit adds a fallback when attempting to merge events that
collide on a hash but do not actually merge. Previously, the latter
event would be dropped.

This also fixes a minor UX problem where moving the isNull check into
the merging loop resulted in extra events in the undo queue that
served no purpose and required multiple undo operations without visual
feedback.

Fixes #1373
2017-10-27 16:04:17 -07:00
Neil Fraser
2445a752b7 Resolve another 20 warnings. 2017-10-24 14:06:29 -07:00
Neil Fraser
4262b09002 Resolve 106 warnings. 2017-10-24 14:06:29 -07:00
Andrew n marshall
f992ea0f9c Fix #1369: resource loading order constraints, interpolation tokens in message expansion (PR #1383)
This fixes race condition in #1369 by using message references instead of explicit string lookups. This required fixing a bug the token interpolation parser that was breaking on the inner '"%1"' for these tooltips.
2017-10-24 13:02:14 -07:00
Neil Fraser
82705923cb Convert compile demo into a unit test. (#1360)
* Intentionally break Travis.

* Alphabetize tests, remove orphaned test, and add fail to test that's running.

* Unbreak test, disable OS X, move scripts, list compiler directory.

* Test Java, break test.

* Unbreak test, call compile script.

* Compile main_compressed.js

* Run test command using bash.

* Fix path.

* Exclude node modules.

* Be more specific about JS files to compile.

* Test failure.

* Restore OSX, undo Blockly failure, remove compilation demo, add compilation test.

* Delete manual test files.

* Ignore downloaded/generated files.

* Whitespace cleanup.
2017-10-12 14:54:57 -07:00
Rachel Fenichel
c381808120 Tests for widget div math. (#1338)
* New widget div functions, used in context menu code

* Make all widget div positioning functions use the same argument order

* Use new widget div functions for fields

* share code for measuring menu size

* Get rid of positionMenu

* Update copyright date

* Rebuild blockly_uncompressed because there's a new require in town

* Test for widget div math
2017-09-22 16:10:47 -07:00
picklesrus
5518873389 Revert "Remove all all instances calling setValue on variable fields with the name instead of the id" (#1296)
* Revert "Create WorkspaceViewport class (#1291)"

This reverts commit 6c00d77c9e.

* Revert "Remove all all instances calling setValue with name. (#1254)"

This reverts commit 8e8b6b27af.
2017-08-28 16:55:44 -07:00
marisaleung
8e8b6b27af Remove all all instances calling setValue with name. (#1254) 2017-08-24 14:34:01 -07:00
Evan W. Patton
e1e94271c4 Implement Blockly.Events.filter in linear time (#1205)
* Implement Blockly.Events.filter in linear time

For large App Inventor projects (order 1k+ blocks, 100+ top-level
blocks), the O(n^2) behavior of Blockly.Event.filter was causing
performance issues when rearranging blocks or pasting from the
backpack. This commit provides a linear merge implementation using a
key that uniquely identifies a block so that multiple events targeting
the same block are merged. This change benefits from O(1) amortized
lookup using an object as a key-value store.

* Add event filter unit tests and fix logic bugs

* Update Blockly.Events.filter unit tests
2017-08-18 14:18:47 -07:00
marisaleung
234c53157f Fix Blockly.Procedures.isNameUsed return values.
Add tests for Procedures.isNameUsed() so this bug never happens again.
2017-07-28 12:02:14 -07:00
marisaleung
733d869f8e Add VariableType checks. 2017-07-20 16:47:37 -07:00
marisaleung
15d47840b1 Fire field variable change event with variable value, not name. 2017-06-29 11:24:25 -07:00
marisaleung
3c8e0ebbeb Dropdown Create does not create a missing variable twice. 2017-06-27 16:51:19 -07:00
marisaleung
4a2c95fd1b Revamping mostly gesture tests. 2017-06-22 16:56:28 -07:00
marisaleung
5b1a0ae284 Test Delete Variable Twice. 2017-06-09 16:32:16 -07:00
marisaleung
d852a2b116 In DropdownCreate check for Msg.DELETE_VARIABLE. 2017-06-09 16:22:25 -07:00
marisaleung
c58553b7ba Create utility function for checking variable values. 2017-06-09 15:24:31 -07:00
marisaleung
833c2d0c40 Fire VAR events and test. 2017-06-09 14:42:14 -07:00
marisaleung
e9a480c51f Add VAR events. 2017-06-08 15:15:17 -07:00
marisaleung
0040ff636c Field Variable setValue() looks up variable. 2017-06-06 15:29:28 -07:00