Commit graph

88 commits

Author SHA1 Message Date
Karishma Chadha
c761a9c82e Fix issue where non-strings were getting passed in to escape functions for handling special characters that can appear in xml. Add tests. 2019-02-07 11:58:10 -05:00
Paul Kaplan
765f2b2549
Merge pull request #1983 from picklesrus/broadcast-msg-chars
Broadcast msg chars
2019-02-07 08:32:55 -05:00
Paul Kaplan
6deab79903
Merge pull request #1979 from paulkaplan/share-blocks-new-ids
Add a utility for giving blocks new IDs, use it for sharing blocks.
2019-02-07 08:31:25 -05:00
picklesrus
b904f19c1d Fix loading broadcast messages with special characters for projects that were converted from 2.0. 2019-02-06 16:58:46 -05:00
Paul Kaplan
31fbcfa4d7 Add a utility for giving blocks new IDs, use it for sharing blocks. 2019-02-06 10:16:22 -05:00
Karishma Chadha
af0bebb773
Fix typo in comment 2019-02-04 23:33:18 -05:00
Karishma Chadha
d91c19434f Rename util function to be more descriptive. Refactor parameters to remove unused code. 2019-02-04 19:05:28 -05:00
Karishma Chadha
7faddb6c8f Replace xml-unsafe chars in sb3 variables. 2019-02-04 15:32:01 -05:00
Karishma Chadha
57f112cbfd Remove unsafe chars from variable ids when importing from 2.0. 2019-02-04 10:29:24 -05:00
Paul Kaplan
4fe06153d6
Merge pull request #1809 from paulkaplan/serialize-infinity
Serialize Infinity and NaN to 0
2018-12-05 08:28:50 -05:00
Paul Kaplan
7e96ef2985 Serialize Infinity and NaN to 0 2018-12-04 10:52:49 -05:00
Katie Broida
967cab8f20
Make the wait block's logic and behavior more consistent with Scratch 2 (#1759) 2018-12-04 10:35:42 -05:00
DD Liu
122443a75f
Merge pull request #1754 from bocoup/handle-infinity
Make Scratch 3 comparisons with +/-Infinity match Scratch 2
2018-11-29 14:31:10 -05:00
Valerie R Young
8c2da6b56a Satisfy linter 2018-11-29 14:07:27 -05:00
Valerie R Young
70f00e30c4 Revert changes to toNumber, fix comparison of infinity in cast.compare 2018-11-27 17:53:20 -05:00
Evelyn Eastmond
9c3518ba6d Adding check for open request before calling reject/resolve. Resolves #1764. 2018-11-27 09:43:53 -05:00
Valerie R Young
3fe1d3bf6d Minor typo 2018-11-13 14:58:28 -05:00
Valerie R Young
43c5d5c053 Correct infinity comparisons and toNumber 2018-11-13 13:51:12 -05:00
Karishma Chadha
87244b4110 Normalize capitalization of sensing_current block fields during sb2 import and during monitor id generation. Update monitors integration test to include sensing_current block monitors. 2018-11-08 14:11:30 -05:00
Karishma Chadha
5db3db3a92 monitor id getter should use block fields instead of a list of strings 2018-11-08 01:33:26 -05:00
Karishma Chadha
0e7eae98d5 Separate out monitors for blocks reporter blocks that have parameters. 2018-11-08 00:37:28 -05:00
Michael "Z" Goddard
ec414fffc6
use Number.isNaN in Cast.toNumber
Number.isNaN does not coerce and may help performance since we either
do not need to coerce the value or already have with Number.
2018-10-31 14:40:19 -04:00
Michael "Z" Goddard
5b10d41ba3
check if toNumber is given a number and shortcut if so
If toNumber is called on a number avoiding passing the number to Number
can provide a small performance improvement.
2018-10-30 11:28:22 -04:00
Andrew Sliwinski
853de9fa7d
Merge pull request #1593 from joker314/fix/compare-strings
Fix locale-dependant string comparison operators to match 2.0
2018-10-04 14:38:40 -04:00
jokebookservice1
ab8d4dc560
style(util): Address linting issues 2018-09-17 22:07:26 +01:00
jokebookservice1
dab78c4f62
fix(util): Make string comparisons match Flash's, everywhere 2018-09-17 21:25:14 +01:00
Christopher Willis-Ford
69ba2045fe Rename TokenBucket to TaskQueue 2018-09-14 22:34:34 -04:00
Christopher Willis-Ford
70c6ad4ef1 Add cancelAll method to clear the task queue 2018-09-14 22:10:17 -04:00
Christopher Willis-Ford
33e0197ad5 Add tests for TokenBucket 2018-09-13 17:05:00 -04:00
Christopher Willis-Ford
28621c9860 Protect against NaN task cost 2018-09-13 17:05:00 -04:00
Christopher Willis-Ford
c8dc8fb5b9 Add TokenBucket utility class 2018-09-13 17:05:00 -04:00
Eric Rosenbaum
39be6d873c
Rate-limiting with a token bucket for the WeDo extension (#1540)
* Initial version of token bucket

* Add rateLimiter util

* Remove check for motor.isOn in stopAllMotors

* Fix unit test

* Fix unit test with stubbed timer, and cleanup

* Add comment

* Reduce WeDo rate limit to 20 sends/sec

* Move rate limit into a constant

* Stop button stops motors and tone even if rate limit exceeded
2018-08-29 17:37:59 -04:00
Paul Kaplan
138d7136af Fix various jsdoc issues preventing the docs from building 2018-07-31 11:22:42 -04:00
Karishma Chadha
812e7a3772 Preserve sprite layer order information across saving and loading an sb3. 2018-07-24 11:00:48 -04:00
Eric Rosenbaum
e02dd35dbf remove logging 2018-07-09 13:49:41 -04:00
Evelyn Eastmond
190f4b5796 Fixing linting errors. 2018-07-09 13:49:41 -04:00
Evelyn Eastmond
d79efbece8 Some logging cleanup. 2018-07-09 13:49:41 -04:00
Evelyn Eastmond
613a9f96c3 Adding initial test polling for EV3 distance sensor data. 2018-07-09 13:49:41 -04:00
Evelyn Eastmond
2d8ad05a78 Adding Ev3 extension with three test blocks to latest device-connection work, auto-connecting to device for now. 2018-07-09 13:49:40 -04:00
Evelyn Eastmond
73cc149783 Adding promises to return on BLE write. Some refactoring. 2018-07-09 13:41:57 -04:00
Evelyn Eastmond
d09c3f0418 MicroBit extension, Scratch Link first draft. (#1230)
* First microbit gui tests

* Fixed JSONRPC inheritance.  Renamed ScratchBLE/ScratchBT files.  Removed ScratchBT test code from Microbit extension.  Renamed addLine to log.

* Fixed log comments.  Removed addLine from Microbit.

* Adding auto-connect to Microbit at extension loading.  Adding hack for displayText block to Scratch-Link.

* Resolved merge conflicts and brought in latest microbit extension example code.

* Updated microbit write tests for displayText and displaySymbol blocks.  Some linting.

* Some linting and adding of BLE Characteristic consts.

* Linting fixes.

* Moving micro:bit device connection code all to the MicroBit class, decoupling Scratch3MicroBitBlocks from connection code.

* Removing old disconenct handlers from MicroBit class.  Moved service into new BLEUUID data structure.

* Renamed _write to _send.  Moved all BLE encoding concerns to the _send method.

* Using the util log.  Some linting.

* Added _read method to MicroBit class.  Renamed _send to _write.

* Some linting and formatting comments.

* First pass at peripheral chooser pattern for ScratchBLE.

* Testing characteristicDidChange events, and some changes to ScratchBLE on ready events.

* Refactoring work on PeripheralChooser and ScratchBLE.

* Some variable renaming and method signature stubs.

* Peripheral chooser method signatures.

* Moved base64 encoding/decoding to util.  Some method signature formatting.

* Adding test stubs for new util and io classes.

* Adding test stub for MicroBit extension.

* Clean up for PR.

* Clean up for PR.

* Final cleanup for PR.

* Removed logging to console.

* Adding 'btoa' and 'atob' node modules and using them in Base64Util.
2018-06-18 14:56:51 -04:00
Christopher Willis-Ford
53b5ba93f5 Add tests for converting extension metadata
These tests convert some extension metadata into scratch-blocks JSON and
XML, then verify that the JSON and XML are as expected.
2018-04-09 15:37:08 -07:00
Christopher Willis-Ford
f8db6c3f02 Support extension translation
The new `maybeFormatMessage` function detects whether its argument
looks like a message descriptor object and, if so, will call
`formatMessage` on it. This is now used for all user-visible text fields
in extensions.

Also, messages may use "select" to check the target type with a message
like this: '{targetType, select, stage {text for stage} sprite {text for
sprite} other {text for other}'. Note that the "other" clause is
required by `formatMessage`.
2018-04-05 12:17:05 -07:00
Ray Schamp
32bc087bba Fix remaining lint issues 2017-08-26 13:24:10 -04:00
Ray Schamp
5113876588 Pass with --fix 2017-08-26 13:24:10 -04:00
Christopher Willis-Ford
eb931fd99b Specify dataFormat when loading asset for import
When importing a project we know the file extension for each asset to be
loaded. This change provides that information to the storage system so
that we can load assets which don't use the default. For example, this
allows loading JPG-format backdrops.

In support of this change, there's a new function on `StringUtil` called
`splitFirst`, which splits a string on the first instance of a separator
character. This change includes unit tests for this new function.
2017-05-24 15:35:10 -07:00
Ray Schamp
a4f095db5e Use ES6 style classes 2017-04-17 19:42:48 -04:00
Ray Schamp
e01c4ae108 Pass with --fix 2017-04-17 15:10:04 -04:00
Paul Kaplan
052ecef91c Add string utils with tests 2017-03-20 12:12:38 -04:00
Ray Schamp
b03768cad6 Remove filter toolbox utility (#496)
* Revert "Merge pull request #486 from rschamp/fix-filter-tests"

This reverts commit ba00db897f, reversing
changes made to 739c5deb63.

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

This reverts commit 739c5deb63.

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

This reverts commit 343b5bfe8e, reversing
changes made to 370f2c6a47.
2017-03-09 16:41:06 -05:00