Skip to content

Commit 6a6d661

Browse files
committed
Re-enabled block tests and fixed block specific issues.
Move namespace for some implementations and added fallback for former implementations for compability reasons.
1 parent bfbf467 commit 6a6d661

File tree

36 files changed

+590
-152
lines changed

36 files changed

+590
-152
lines changed

app/chrome_app/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"short_name": "Coding with Chrome",
1010
"description": "Learn, improve, or teach coding skills within a Chrome browser.",
1111
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgSWdCJSwkgFTY9d993Quot277oCS2PCM2H/F6U28NE8D3Z21GXS/7qW8XCGShB054Wboq62pP679f9tB9F+GRHzOh/an4zIu+Uhb3ZKVzZLJbHsP8N+E5wk3wgwOBgE+UXCy9I8i1RpfzutJ4aha+YEzvCsVpo6UwsuWiXORB9yRU5NuooYX+fhVpWZmrZJo4vqzQhuoJ/uWiQujABXXo4qdrclwSw8+JlpWLMqHHQ6HE8Sf7VWDdGvRdYP6LRZobWqovb659qEumJ0bxhwXtHkWgPHQWtW35T/r/oH8uuke35pH+YtBtaOqN5U3bYGPinP0bYrI33OSLUJx/DrC1wIDAQAB",
12-
"version": "5.8.12",
12+
"version": "5.8.16",
1313
"oauth2": {
1414
"client_id": "418162477970-2qmsb2sp3m522hf292154favsjgpsj9n.apps.googleusercontent.com",
1515
"scopes": [

app/nw_app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "binary",
3-
"version": "5.8.12",
3+
"version": "5.8.16",
44
"main": "js/background.js",
55
"window": {
66
"title": "Coding with Chrome",

build/cwc/frameworks.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,19 +218,36 @@ closureBuilder.build({
218218

219219

220220
/**
221-
* Sphero Framework
221+
* Sphero 2.0 Framework
222222
*/
223223
closureBuilder.build({
224-
name: 'cwc.framework.Sphero',
224+
name: 'cwc.framework.sphero.Sphero2',
225225
compress: true,
226226
srcs: glob([
227-
'src/frameworks/sphero/*.js',
227+
'src/frameworks/sphero/sphero2/*.js',
228228
]),
229229
deps: glob([
230230
'src/frameworks/messenger/*.js',
231231
'third_party/coding-with-chrome-libraries/src/utils/stack/stack.js',
232232
]),
233-
out: 'genfiles/core/frameworks/internal/sphero_framework.js',
233+
out: 'genfiles/core/frameworks/internal/sphero2_framework.js',
234+
});
235+
236+
237+
/**
238+
* Sphero SPRK+ Framework
239+
*/
240+
closureBuilder.build({
241+
name: 'cwc.framework.sphero.SprkPlus',
242+
compress: true,
243+
srcs: glob([
244+
'src/frameworks/sphero/sprk_plus/*.js',
245+
]),
246+
deps: glob([
247+
'src/frameworks/messenger/*.js',
248+
'third_party/coding-with-chrome-libraries/src/utils/stack/stack.js',
249+
]),
250+
out: 'genfiles/core/frameworks/internal/sprk_plus_framework.js',
234251
});
235252

236253

build/cwc/main-debug.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ closureBuilder.build({
3131
'gensoyfiles/**/!(*_test).js',
3232
'!src/{blocks,blocks/**.js}',
3333
'!src/{frameworks,frameworks/**.js}',
34-
'third_party/coding-with-chrome-libraries/src/**/!(*_test).js',
34+
'../coding-with-chrome-libraries/src/**/!(*_test).js',
35+
// 'third_party/coding-with-chrome-libraries/src/**/!(*_test).js',
3536
]),
3637
externs: [
3738
'build/externs/blockly.js',

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "coding-with-chrome",
33
"description": "Coding with Chrome",
4-
"version": "5.8.12",
4+
"version": "5.8.16",
55
"author": "Markus Bordihn ([email protected])",
66
"license": "Apache-2.0",
77
"private": true,
@@ -122,10 +122,10 @@
122122
"publish:prepare": "npm run test && npm run clean && npm run build && npm run build:cwc-main",
123123
"show-updates": "ncu",
124124
"sync": "echo Syncing. Please wait ... && git pull && git submodule init && git submodule update && npm run update",
125-
"test": "npm run test:soy && npm run test:units && npm run test:core-mode",
125+
"test": "npm run test:block && npm run test:soy && npm run test:units && npm run test:core-mode",
126126
"test:block": "echo Starting block tests ... && karma start test/block_tests.conf",
127127
"test:core": "echo Starting core tests ... && karma start test/core_tests.conf",
128-
"test:core-mode": "karma start test/core_tests.conf && karma start test/mode_tests.conf",
128+
"test:core-mode": "echo Starting combined core and mode tests ... && karma start test/core_tests.conf && karma start test/mode_tests.conf",
129129
"test:depswriter": "python third_party/closure-library/closure/bin/build/depswriter.py --root_with_prefix=\"src/ ../../../../src/\" --root_with_prefix=\"node_modules/closure-templates// ../../../../node_modules/closure-templates/\" --root_with_prefix=\"test/genfiles/soy/ ../../../../test/genfiles/soy/\" --root_with_prefix=\"third_party/coding-with-chrome-libraries/src/ ../../../../third_party/coding-with-chrome-libraries/src/\" > test/deps.js",
130130
"test:mode": "echo Starting mode tests ... && karma start test/mode_tests.conf",
131131
"test:soy": "echo Starting soy tests ... && karma start test/soy_tests.conf",

src/blocks/phaser/audio/blocks.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ Blockly.Blocks['phaser_audio_add_bgm'] = {
3636
.appendField(new Blockly.FieldNumber(100, 0, 200), 'volume')
3737
.appendField('%')
3838
.appendField(new Blockly.FieldDropdown([
39-
['no loop', false],
40-
['loop', true],
39+
['no loop', 'false'],
40+
['loop', 'true'],
4141
]), 'loop');
4242
this.setPreviousStatement(true, 'Create');
4343
this.setNextStatement(true, 'Create');
@@ -65,8 +65,8 @@ Blockly.Blocks['phaser_audio_add'] = {
6565
.appendField(new Blockly.FieldNumber(100, 0, 200), 'volume')
6666
.appendField('%')
6767
.appendField(new Blockly.FieldDropdown([
68-
['no loop', false],
69-
['loop', true],
68+
['no loop', 'false'],
69+
['loop', 'true'],
7070
]), 'loop');
7171
this.setPreviousStatement(true, 'Create');
7272
this.setNextStatement(true, 'Create');

src/blocks/phaser/audio/javascript.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Blockly.JavaScript['phaser_audio_add_bgm'] = function(block) {
3232
'variable', Blockly.JavaScript.ORDER_ATOMIC);
3333
return 'if (typeof ' + variable + ' === \'undefined\') {\n' +
3434
' ' + variable + ' = game.add.audio(\'' + text_audio + '\', ' +
35-
number_volume / 100 + ', ' + (dropdown_loop || 'false') + ');\n' +
35+
number_volume / 100 + ', ' + dropdown_loop + ');\n' +
3636
'} else {\n ' + variable + '.stop();\n}\n' +
3737
variable + '.play();\n';
3838
};
@@ -50,7 +50,7 @@ Blockly.JavaScript['phaser_audio_add'] = function(block) {
5050
let variable = Blockly.JavaScript.valueToCode(block,
5151
'variable', Blockly.JavaScript.ORDER_ATOMIC);
5252
return variable + ' = game.add.audio(\'' + text_audio + '\', ' +
53-
number_volume / 100 + ', ' + (dropdown_loop || 'false') + ');\n';
53+
number_volume / 100 + ', ' + dropdown_loop + ');\n';
5454
};
5555

5656

src/blocks/phaser/world/blocks.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ Blockly.Blocks['phaser_world_sort_direction'] = {
125125
.appendField(i18t('@@BLOCKS__SET'))
126126
.appendField(i18t('@@BLOCKS_PHASER__WORLD_SORT_DIRECTION'))
127127
.appendField(new Blockly.FieldDropdown([
128-
[i18t('none'), 0],
129-
[i18t('left to right'), 1],
130-
[i18t('right to left'), 2],
131-
[i18t('top to bottom'), 3],
132-
[i18t('bottom to top'), 4],
128+
[i18t('none'), '0'],
129+
[i18t('left to right'), '1'],
130+
[i18t('right to left'), '2'],
131+
[i18t('top to bottom'), '3'],
132+
[i18t('bottom to top'), '4'],
133133
]), 'property');
134134
this.setPreviousStatement(true, 'Create');
135135
this.setNextStatement(true, 'Create');

src/blocks/phaser/world/javascript.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,6 @@ Blockly.JavaScript['phaser_world_arcade_physics'] = function(block) {
7979
*/
8080
Blockly.JavaScript['phaser_world_sort_direction'] = function(block) {
8181
let dropdown_property = block.getFieldValue('property');
82-
return 'game.physics.arcade.sortDirection = ' + dropdown_property + ';\n';
82+
return 'game.physics.arcade.sortDirection = ' +
83+
Number(dropdown_property) || 0 + ';\n';
8384
};

src/blocks/simple/javascript.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ Blockly.JavaScript['simple_draw_text'] = function(block) {
210210
Blockly.JavaScript.ORDER_ATOMIC);
211211
let y = Blockly.JavaScript.valueToCode(block, 'y',
212212
Blockly.JavaScript.ORDER_ATOMIC);
213-
let fillColor = Blockly.JavaScript.valueToCode(block, 'fillColor');
213+
let fillColor = Blockly.JavaScript.valueToCode(block, 'fillColor',
214+
Blockly.JavaScript.ORDER_ATOMIC);
214215
return 'draw.text(' + text + ', ' + x + ', ' + y + ', ' + fillColor + ');\n';
215216
};

0 commit comments

Comments
 (0)