Commit Graph

83 Commits

Author SHA1 Message Date
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
marisaleung
ccf3ad1473 Add BLOCK events and constructor tests. 2017-06-01 12:38:38 -07:00
marisaleung
cd0487e816 Clean up and create test utilities file. 2017-06-01 10:36:01 -07:00
marisaleung
a6f85cec53 Appease eslint: semicolons and such. 2017-05-25 13:44:06 -07:00
marisaleung
dc06872a37 Deserialization variables at top. 2017-05-24 15:29:46 -07:00
marisaleung
ce4a84b3cf Include variables at top of serialization. 2017-05-24 10:53:44 -07:00
marisaleung
e84121690b Merge pull request #1113 from marisaleung/SmallFix
Small fix
2017-05-23 11:40:39 -07:00
marisaleung
1cd8e1fcc1 Add type, id, and info to the generated xml.
Add xml tests for fieldToDom.
Update workspace tests to pass with new changes.
2017-05-19 15:47:39 -07:00
marisaleung
cd5bb0d888 Changed parameter name in workspace for clarity. 2017-05-18 14:14:17 -07:00
shirletan
7a2c01e1cf Work around timing issue with travis osx issue (#1092)
* add more wait time for test setup

* increase selenium wait time

* add more wait
2017-05-09 16:39:39 -07:00
marisaleung
0e0b1a3ebd Merge branch 'develop' into develop 2017-05-04 12:38:15 -07:00
marisaleung
12ea998155 Created separate file for VariableMap 2017-05-03 17:04:15 -07:00
marisaleung
2b1fe1c4e3 Merge pull request #1071 from marisaleung/develop
VariableMap and functions added.
2017-05-03 13:20:05 -07:00
marisaleung
d903b5e86b VariableMap and functions added. 2017-05-03 10:51:24 -07:00
marisaleung
b159c7c3b5 Create separate file for VariableMap and its functions. 2017-05-02 15:06:12 -07:00
marisaleung
2994805e6a VariableMap and functions added. 2017-05-02 10:07:46 -07:00
marisaleung
54178c65ae Merge pull request #1055 from marisaleung/develop
Create a variable model with name, id, and type.
2017-04-20 13:31:22 -07:00
marisaleung
9577e5ddc4 Created a variable model with name, id, and type.
Created a jsunit test file for variable model.
2017-04-20 13:19:53 -07:00
RoboErikG
a8da16036e Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* create .travis for ci job

* initial checkin for blocky-web travis ci job

* rename file to .travis.yaml for typo

* remove after_script

* added cache

* rename .travis.yaml to .travis.yml

* Update .travis.yml

* include build script

* fix yaml file format issue

* debug install part

* debug build issue

* Update .travis.yml

* remove cache for now

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* more debug info

* Update .travis.yml

* Update .travis.yml

* fix typo

* installing chrome browser

* remove chrome setting config

* run build.py as part of npm install

* Update .travis.yml

* update karma dependency

* use karma as test runner

* fix typo

* remove karma test for now

* Update .travis.yml

* Update package.json

* add npm test target

* add browserstack-runner depdendency

* update browser support

* fix typo for test target

* fix chrome typo

* added closure dependency

* add google-closure-library

* include blockly_uncompressed.js and core.js dependency

* uncomment out core/*.js files

* add kama job as part of install

* remove browserstack add on for now

* fix karma config typo

* add karma-closure

* add os support

* remove typo config

* include more closure files

* change os back to linux

* use closure-library from node_modules

* change log level back to INFO

* change npm test target to use open browser command instead of karma

* change travis test target to use open command instead of karma

* list current directory

* find what's in current dir

* typo command

* Update .travis.yml

* typo again

* open right index.html

* use right path for index.html

* xdg-open to open default browser on travis

* exit browser after 5s wait

* change timeout to 1 min

* exit after opening up browser

* use browser only

* use karma

* remove un-needed dependency

* clean up script section

* fix typo

* update build status on readme

* initial commit for selenium integration tests

* update selenium jar path

* fix test_runner.js typo

* add more debug info

* check java version

* add && instead of 9288

* fix java path

* add logic to check if selenium is running or not

* add some deugging info

* initial commit to get chromedriver

* add chromedriver flag

* add get_chromedriver.sh to package.json and .travel

* change browser to chrome for now

* fix path issue

* update chromdriver path

* fix path issue again

* more debugging

* add debug msg

* fix typo

* minor fix for getting chromedriver

* install latest chrome browser

* clean up pakcage.json

* use npm target for test run

* remove removing trailing comma

* fix another trailing comma

* updated travis test target

* clean up scripts

* not sure nmp run preinstall

* redirect selenium log to tmp file

* revert writing console log to file

* update test summary

* more clean up

* minor clean up before pull request

* resolved closure-library conflict

1. add closure-library to dependencies instead of devDependencies.
2. add lint back in scripts block

* fix typo (adding comma) in script section
2017-04-11 13:38:11 -07:00
Andrew n marshall
6313b202f7 unction to function corrects #962 (#970) 2017-03-08 07:47:48 -08:00
Andrew n marshall
6e1ffe09c2 Adding Blockly.Xml.appendDomToWorkspace() (#962)
This is a copy (with additional comments) of PR #822 (and also #961) by @qnoirhomme with unrelated files removed. See #822 for full review.
2017-03-03 08:40:00 -08:00
Rachel Fenichel
c30928a177 Make some functions private and add tests 2017-02-24 15:51:59 -08:00
Andrew n marshall
6b692a0802 Initial text block, with a mixin to generate quote image fields. (#923)
Text block now uses the extension "text_quotes", supported by Blockly.Constants.Text.QUOTE_IMAGE_MIXIN.quoteField_(fieldName), so that each platform can use the best platform appropriate image (size, density, etc.) for the quotes.
2017-02-13 15:00:02 -08:00
Rachel Fenichel
5a40208138 Separate tests 2017-02-06 15:25:59 -08:00
Rachel Fenichel
630863d9db Add isEditable to field, and add tests 2017-02-06 14:47:45 -08:00
Andrew n marshall
15827c5d30 Adds Block.prototype.mixin() and Blockly.Extensions.registerMixin(). (#907)
Adds Block.prototype.mixin() and Blockly.Extensions.registerMixin().
This adds support for a common use pattern in extensions, and adds
error checking to avoid future incompatibilities.
2017-02-06 10:00:08 -08:00
Andrew n marshall
5891288d60 .getOptions_() to .getOptions() (#869)
Fixes #867.
2017-01-26 09:52:00 -08:00
Andrew n marshall
0da5dda1f0 Fixing JSON support for images in dropdowns. Adding tests. (#851)
Fixes #848.
2017-01-23 13:39:14 -08:00
Andrew n marshall
fb0f1b05dd Unit tests for JSON block definitions (just the start) (#850)
* Beginnings of a JSON block definition unit test set.
 * Dispose of unit test workspaces and blocks in finally blocks.
 * Clarify JSON error message by echoing arg notation.
2017-01-20 14:18:33 -08:00
Andrew n marshall
78dc5ed9c2 JSON definitions for colour blocks (#838)
Replaces old colour block definitions with a Blockly.defineBlocksWithJsonArray(..) call. Generator unit tests continue to load and pass, signifying compatibility with prior block definitions.

Replaces extension 'math_number_tooltip' with the reusable 'parent_tooltip_when_inline' extension, also used by colour_picker. Includes tests.
2017-01-18 13:48:46 -08:00
Andrew n marshall
a47bd93f4c Adding extensions for JSON support of dynamic blocks. (#834)
Adding support for extensions, functions that can assist with loading blocks, much like init functions, but that can be referenced from JSON definitions. This allows JSON definitions to define dynamic blocks such as onchange handlers and mutators.

Rewrote math_number as an example pure JSON block.
2017-01-18 12:45:39 -08:00
Andrew n marshall
bf16f11dbd Replace single quotes with double. (#836)
Fixes commits in #832.
2017-01-18 09:24:29 -08:00
Andrew n marshall
211d973054 FieldNumber & FieldAngle: Default value "0" (#832)
FieldNumber and FieldAngle previously accepted "undefined" as values, if not defined in JSON. This catches these and uses "0" for any NaN value.  The constructor value parameter is now optional. Includes tests.
2017-01-17 15:39:59 -08:00
Andrew n marshall
ac3df2759c PR #818: Adding support for string table lookups in dropdown field labels
Adding support for string table lookups in dropdown field labels specified in JSON.

Adds Blockly.utils.replaceMessageReferences() method to handle string replacement without interpolation tokens.  Effectively uses the same old code, now moved into tokenizeInterpolation_(), which takes a parseInterpolationTokens option.

Replaces the direct JavaScript references (not pure JSON, and thus not portable).

Demonstrating this behavior in the logic_boolean dropdown.
2017-01-11 15:47:56 -08:00
picklesrus
e1cd21842a Add a workspace drag surface that blocks and bubble get moved to duri… (#778)
* Add a workspace drag surface that blocks and bubble get moved to during a workspace drag.
The surface is translated using translate3d instead of svg's translate attribute so that
the browser does not have to repaint the entire workspace on every mouse move.
This is very similar to the block drag surface.

* Address code review comments

* add back hasClass_ utility removed in #748 and stop using contains since it is not supported in IE
2016-12-15 11:02:49 -08:00
Andrew n marshall
e5d25bb686 String reference in JSON string messages (#741)
* Adds message references to message string interpolation, in the form of %{BKY_STRING}.
 * Re-adding CONTROLS_IFELSE block using the new syntax, referencing to CONTROL_IF equivalents.
2016-11-15 15:51:51 -08:00