diff --git a/.eslintignore b/.eslintignore
index 3bcef4777..38c86f3d1 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,4 +1,5 @@
*_compressed*.js
+blockly_uncompressed.js
gulpfile.js
/msg/*
/build/*
diff --git a/.eslintrc.json b/.eslintrc.json
index 28766db11..0db17830b 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -48,7 +48,19 @@
"balanced": true
},
"exceptions": ["*"]
- }]
+ }],
+ // Blockly uses prefixes for optional arguments and test-only functions.
+ "camelcase": ["error", {
+ "properties": "never",
+ "allow": ["^opt_", "^_opt_", "^testOnly_"]
+ }],
+ // Use clang-format for indentation by running `npm run format`.
+ "indent": ["off"],
+ // Blockly uses capital letters for some non-constructor namespaces.
+ // Keep them for legacy reasons.
+ "new-cap": ["off"],
+ // Mostly use default rules for brace style, but allow single-line blocks.
+ "brace-style": ["error", "1tbs", { "allowSingleLine": true }]
},
"env": {
"es6": true,
diff --git a/scripts/migration/renamings.js b/scripts/migration/renamings.js
index cfffd7855..e59a541fb 100644
--- a/scripts/migration/renamings.js
+++ b/scripts/migration/renamings.js
@@ -216,7 +216,7 @@ const renamings = {
'Blockly.Blocks.texts': {module: 'Blockly.blocks.texts'},
'Blockly.Blocks.variables': {module: 'Blockly.blocks.variables'},
// Blockly.Blocks.variablesDynamic not previously provided.
- }
+ },
};
exports.renamings = renamings;
diff --git a/tests/mocha/.eslintrc.json b/tests/mocha/.eslintrc.json
index 0aa6e5b1e..c4ed4257a 100644
--- a/tests/mocha/.eslintrc.json
+++ b/tests/mocha/.eslintrc.json
@@ -30,7 +30,11 @@
"es5/no-template-literals": ["off"],
"es5/no-typeof-symbol": ["off"],
"es5/no-unicode-code-point-escape": ["off"],
- "es5/no-unicode-regex": ["off"]
+ "es5/no-unicode-regex": ["off"],
+ // Allow uncommented helper functions in tests.
+ "require-jsdoc": ["off"],
+ // In mocha tests in suites, `this` is meaningful and useful.
+ "no-invalid-this": ["off"]
},
"extends": "../../.eslintrc.json"
}
diff --git a/tests/mocha/astnode_test.js b/tests/mocha/astnode_test.js
index 4a63f2e17..e370d4dd7 100644
--- a/tests/mocha/astnode_test.js
+++ b/tests/mocha/astnode_test.js
@@ -20,27 +20,27 @@ suite('ASTNode', function() {
{
"type": "field_input",
"name": "NAME",
- "text": "default"
+ "text": "default",
},
{
"type": "field_input",
"name": "NAME",
- "text": "default"
+ "text": "default",
},
{
"type": "input_value",
- "name": "NAME"
+ "name": "NAME",
},
{
"type": "input_statement",
- "name": "NAME"
- }
+ "name": "NAME",
+ },
],
"previousStatement": null,
"nextStatement": null,
"colour": 230,
"tooltip": "",
- "helpUrl": ""
+ "helpUrl": "",
},
{
"type": "value_input",
@@ -48,12 +48,12 @@ suite('ASTNode', function() {
"args0": [
{
"type": "input_value",
- "name": "NAME"
- }
+ "name": "NAME",
+ },
],
"colour": 230,
"tooltip": "",
- "helpUrl": ""
+ "helpUrl": "",
},
{
"type": "field_input",
@@ -62,14 +62,14 @@ suite('ASTNode', function() {
{
"type": "field_input",
"name": "NAME",
- "text": "default"
- }
+ "text": "default",
+ },
],
"output": null,
"colour": 230,
"tooltip": "",
- "helpUrl": ""
- }
+ "helpUrl": "",
+ },
]);
this.workspace = new Blockly.Workspace();
this.cursor = this.workspace.cursor;
@@ -92,7 +92,7 @@ suite('ASTNode', function() {
statementInput3: statementInput3,
statementInput4: statementInput4,
fieldWithOutput: fieldWithOutput,
- valueInput: valueInput
+ valueInput: valueInput,
};
});
teardown(function() {
@@ -166,7 +166,6 @@ suite('ASTNode', function() {
const newASTNode = node.findFirstFieldOrInput_(this.blocks.statementInput4);
chai.assert.equal(newASTNode.getLocation(), field);
});
-
});
suite('NavigationFunctions', function() {
@@ -177,7 +176,7 @@ suite('ASTNode', function() {
"previousStatement": null,
"colour": 230,
"tooltip": "",
- "helpUrl": ""
+ "helpUrl": "",
},
{
"type": "start_block",
@@ -185,7 +184,7 @@ suite('ASTNode', function() {
"nextStatement": null,
"colour": 230,
"tooltip": "",
- "helpUrl": ""
+ "helpUrl": "",
},
{
"type": "fields_and_input",
@@ -194,26 +193,26 @@ suite('ASTNode', function() {
{
"type": "field_input",
"name": "NAME",
- "text": "default"
+ "text": "default",
},
{
- "type": "input_dummy"
+ "type": "input_dummy",
},
{
"type": "field_input",
"name": "NAME",
- "text": "default"
+ "text": "default",
},
{
"type": "input_value",
- "name": "NAME"
- }
+ "name": "NAME",
+ },
],
"previousStatement": null,
"nextStatement": null,
"colour": 230,
"tooltip": "",
- "helpUrl": ""
+ "helpUrl": "",
},
{
"type": "two_fields",
@@ -222,12 +221,12 @@ suite('ASTNode', function() {
{
"type": "field_input",
"name": "NAME",
- "text": "default"
- }
+ "text": "default",
+ },
],
"colour": 230,
"tooltip": "",
- "helpUrl": ""
+ "helpUrl": "",
},
{
"type": "fields_and_input2",
@@ -235,48 +234,48 @@ suite('ASTNode', function() {
"args0": [
{
"type": "input_value",
- "name": "NAME"
+ "name": "NAME",
},
{
"type": "field_input",
"name": "NAME",
- "text": "default"
+ "text": "default",
},
{
"type": "input_value",
- "name": "NAME"
+ "name": "NAME",
},
{
"type": "input_statement",
- "name": "NAME"
- }
+ "name": "NAME",
+ },
],
"colour": 230,
"tooltip": "",
- "helpUrl": ""
+ "helpUrl": "",
},
{
"type": "dummy_input",
"message0": "Hello",
"colour": 230,
"tooltip": "",
- "helpUrl": ""
+ "helpUrl": "",
},
{
"type": "dummy_inputValue",
"message0": "Hello %1 %2",
"args0": [
{
- "type": "input_dummy"
+ "type": "input_dummy",
},
{
"type": "input_value",
- "name": "NAME"
- }
+ "name": "NAME",
+ },
],
"colour": 230,
"tooltip": "",
- "helpUrl": ""
+ "helpUrl": "",
},
{
"type": "output_next",
@@ -285,7 +284,7 @@ suite('ASTNode', function() {
"colour": 230,
"tooltip": "",
"helpUrl": "",
- "nextStatement": null
+ "nextStatement": null,
}]);
const noNextConnection = this.workspace.newBlock('top_connection');
const fieldAndInputs = this.workspace.newBlock('fields_and_input');
@@ -658,7 +657,7 @@ suite('ASTNode', function() {
});
test('fromStackToWorkspace', function() {
const stub = sinon.stub(this.blocks.statementInput4,
- "getRelativeToSurfaceXY").returns({x: 10, y:10});
+ "getRelativeToSurfaceXY").returns({x: 10, y: 10});
const node = ASTNode.createStackNode(this.blocks.statementInput4);
const outNode = node.out();
chai.assert.equal(outNode.getType(), ASTNode.types.WORKSPACE);
diff --git a/tests/mocha/block_create_event_test.js b/tests/mocha/block_create_event_test.js
index b1a07e7dd..91a84af3e 100644
--- a/tests/mocha/block_create_event_test.js
+++ b/tests/mocha/block_create_event_test.js
@@ -30,17 +30,17 @@ suite('Block Create Event', function() {
"type": "text",
"id": "shadowId",
"fields": {
- "TEXT": "abc"
- }
+ "TEXT": "abc",
+ },
},
"block": {
"type": "text",
"fields": {
- "TEXT": ""
- }
- }
- }
- }
+ "TEXT": "",
+ },
+ },
+ },
+ },
},
this.workspace);
Blockly.Events.enable();
diff --git a/tests/mocha/block_json_test.js b/tests/mocha/block_json_test.js
index f56cb7ef0..5aea829b6 100644
--- a/tests/mocha/block_json_test.js
+++ b/tests/mocha/block_json_test.js
@@ -82,7 +82,7 @@ suite('Block JSON initialization', function() {
test('Strings to labels', function() {
this.assertInterpolation(
- ['test1', 'test2', 'test3', { 'type': 'input_dummy'}],
+ ['test1', 'test2', 'test3', {'type': 'input_dummy'}],
[],
undefined,
[
@@ -100,13 +100,13 @@ suite('Block JSON initialization', function() {
},
{
'type': 'input_dummy',
- }
+ },
]);
});
test('Ignore empty strings', function() {
this.assertInterpolation(
- ['test1', '', ' ', { 'type': 'input_dummy'}],
+ ['test1', '', ' ', {'type': 'input_dummy'}],
[],
undefined,
[
@@ -116,13 +116,13 @@ suite('Block JSON initialization', function() {
},
{
'type': 'input_dummy',
- }
+ },
]);
});
test('Insert args', function() {
this.assertInterpolation(
- [1, 2, 3, { 'type': 'input_dummy'}],
+ [1, 2, 3, {'type': 'input_dummy'}],
[
{
'type': 'field_number',
@@ -153,13 +153,13 @@ suite('Block JSON initialization', function() {
},
{
'type': 'input_dummy',
- }
+ },
]);
});
test('String args to labels', function() {
this.assertInterpolation(
- [1, 2, 3, { 'type': 'input_dummy'}],
+ [1, 2, 3, {'type': 'input_dummy'}],
['test1', 'test2', 'test3'],
undefined,
[
@@ -177,13 +177,13 @@ suite('Block JSON initialization', function() {
},
{
'type': 'input_dummy',
- }
+ },
]);
});
test('Ignore empty string args', function() {
this.assertInterpolation(
- [1, 2, 3, { 'type': 'input_dummy'}],
+ [1, 2, 3, {'type': 'input_dummy'}],
['test1', ' ', ' '],
undefined,
[
@@ -193,7 +193,7 @@ suite('Block JSON initialization', function() {
},
{
'type': 'input_dummy',
- }
+ },
]);
});
@@ -217,7 +217,7 @@ suite('Block JSON initialization', function() {
},
{
'type': 'input_dummy',
- }
+ },
]);
});
@@ -226,7 +226,7 @@ suite('Block JSON initialization', function() {
[
{
'type': 'no_field_prefix_field',
- }
+ },
],
[],
undefined,
@@ -236,7 +236,7 @@ suite('Block JSON initialization', function() {
},
{
'type': 'input_dummy',
- }
+ },
]);
});
@@ -245,7 +245,7 @@ suite('Block JSON initialization', function() {
[
{
'type': 'input_prefix_field',
- }
+ },
],
[],
undefined,
@@ -255,7 +255,7 @@ suite('Block JSON initialization', function() {
},
{
'type': 'input_dummy',
- }
+ },
]);
});
@@ -280,7 +280,7 @@ suite('Block JSON initialization', function() {
{
'type': 'input_dummy',
'align': 'CENTER',
- }
+ },
]);
});
});
@@ -361,7 +361,7 @@ suite('Block JSON initialization', function() {
'type': 'field_undefined',
'alt': {
'type': 'field_number',
- 'name': 'FIELDNAME'
+ 'name': 'FIELDNAME',
},
}, 'field_number');
});
@@ -398,7 +398,7 @@ suite('Block JSON initialization', function() {
'type': 'field_undefined5',
'alt': {
'type': 'field_number',
- 'name': 'FIELDNAME'
+ 'name': 'FIELDNAME',
},
},
},
@@ -409,7 +409,7 @@ suite('Block JSON initialization', function() {
test('No alt', function() {
this.assertField({
- 'type': 'field_undefined'
+ 'type': 'field_undefined',
}, null);
});
@@ -418,7 +418,7 @@ suite('Block JSON initialization', function() {
'type': 'field_undefined',
'alt': {
'type': 'field_undefined',
- }
+ },
}, null);
});
@@ -524,7 +524,7 @@ suite('Block JSON initialization', function() {
this.assertInput(
{
'type': 'input_dummy',
- 'check': 'Integer'
+ 'check': 'Integer',
},
'input_dummy',
'Integer');
@@ -534,7 +534,7 @@ suite('Block JSON initialization', function() {
this.assertInput(
{
'type': 'input_dummy',
- 'check': ['Integer', 'Number']
+ 'check': ['Integer', 'Number'],
},
'input_dummy',
['Integer', 'Number']);
@@ -544,7 +544,7 @@ suite('Block JSON initialization', function() {
this.assertInput(
{
'type': 'input_dummy',
- 'check': ''
+ 'check': '',
},
'input_dummy');
});
diff --git a/tests/mocha/block_test.js b/tests/mocha/block_test.js
index ffd3ecca3..91e86594a 100644
--- a/tests/mocha/block_test.js
+++ b/tests/mocha/block_test.js
@@ -18,13 +18,13 @@ suite('Blocks', function() {
Blockly.defineBlocksWithJsonArray([
{
"type": "empty_block",
- "message0": ""
+ "message0": "",
},
{
"type": "stack_block",
"message0": "",
"previousStatement": null,
- "nextStatement": null
+ "nextStatement": null,
},
{
"type": "row_block",
@@ -32,10 +32,10 @@ suite('Blocks', function() {
"args0": [
{
"type": "input_value",
- "name": "INPUT"
- }
+ "name": "INPUT",
+ },
],
- "output": null
+ "output": null,
},
{
"type": "statement_block",
@@ -43,11 +43,11 @@ suite('Blocks', function() {
"args0": [
{
"type": "input_statement",
- "name": "STATEMENT"
- }
+ "name": "STATEMENT",
+ },
],
"previousStatement": null,
- "nextStatement": null
+ "nextStatement": null,
}]);
});
teardown(function() {
@@ -73,7 +73,7 @@ suite('Blocks', function() {
return {
A: blockA, /* Parent */
B: blockB, /* Middle */
- C: blockC /* Child */
+ C: blockC, /* Child */
};
}
@@ -325,9 +325,9 @@ suite('Blocks', function() {
"args0": [
{
"type": "input_value",
- "name": "VALUE"
- }
- ]
+ "name": "VALUE",
+ },
+ ],
},
]);
});
@@ -1132,7 +1132,7 @@ suite('Blocks', function() {
setup(function() {
this.workspace = Blockly.inject('blocklyDiv', {
comments: true,
- scrollbars: true
+ scrollbars: true,
});
this.block = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(
''
@@ -1376,10 +1376,10 @@ suite('Blocks', function() {
{
"type": "field_variable",
"name": "NAME",
- "variable": "x"
- }
+ "variable": "x",
+ },
],
- }
+ },
]);
});
teardown(function() {
@@ -1818,12 +1818,12 @@ suite('Blocks', function() {
''
), this.workspace);
this.workspace.setTheme(new Blockly.Theme('test', {
- "styleOne" : {
+ "styleOne": {
"colourPrimary": "#000000",
"colourSecondary": "#999999",
"colourTertiary": "#4d4d4d",
- "hat": ''
- }
+ "hat": '',
+ },
}), {});
});
teardown(function() {
@@ -1864,7 +1864,7 @@ suite('Blocks', function() {
'' +
'' +
'',
- toString: 'repeat 10 times do ?'
+ toString: 'repeat 10 times do ?',
},
{
name: 'nested statement blocks',
@@ -1878,7 +1878,7 @@ suite('Blocks', function() {
'' +
'' +
'',
- toString: 'repeat 10 times do if ? do ?'
+ toString: 'repeat 10 times do if ? do ?',
},
{
name: 'nested Boolean output blocks',
@@ -1894,7 +1894,7 @@ suite('Blocks', function() {
'' +
'' +
'',
- toString: 'if ((? and ?) = ?) do ?'
+ toString: 'if ((? and ?) = ?) do ?',
},
{
name: 'output block',
@@ -1906,7 +1906,7 @@ suite('Blocks', function() {
'' +
'' +
'',
- toString: 'square root 9'
+ toString: 'square root 9',
},
{
name: 'nested Number output blocks',
@@ -1936,7 +1936,7 @@ suite('Blocks', function() {
'' +
'' +
'',
- toString: '(10 × 5) + 3'
+ toString: '(10 × 5) + 3',
},
{
name: 'nested String output blocks',
@@ -1953,15 +1953,15 @@ suite('Blocks', function() {
'' +
'' +
'',
- toString: 'create text with “ Hello ” “ World ”'
+ toString: 'create text with “ Hello ” “ World ”',
},
{
name: 'parentheses in string literal',
xml: '' +
'foo ( bar ) baz' +
'',
- toString: '“ foo ( bar ) baz ”'
- }
+ toString: '“ foo ( bar ) baz ”',
+ },
];
// Create mocha test cases for each toString test.
toStringTests.forEach(function(t) {
@@ -1978,7 +1978,7 @@ suite('Blocks', function() {
Blockly.defineBlocksWithJsonArray([
{
"type": "init_test_block",
- "message0": ""
+ "message0": "",
},
]);
});
diff --git a/tests/mocha/comment_test.js b/tests/mocha/comment_test.js
index 3043dd3e8..fa3a86d6b 100644
--- a/tests/mocha/comment_test.js
+++ b/tests/mocha/comment_test.js
@@ -16,12 +16,12 @@ suite('Comments', function() {
{
"type": "empty_block",
"message0": "",
- "args0": []
+ "args0": [],
},
]);
this.workspace = Blockly.inject('blocklyDiv', {
comments: true,
- scrollbars: true
+ scrollbars: true,
});
this.block = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(
''
diff --git a/tests/mocha/connection_checker_test.js b/tests/mocha/connection_checker_test.js
index 45939f7fa..ea8d8f26c 100644
--- a/tests/mocha/connection_checker_test.js
+++ b/tests/mocha/connection_checker_test.js
@@ -61,10 +61,10 @@ suite('Connection checker', function() {
setup(function() {
// We have to declare each separately so that the connections belong
// on different blocks.
- const prevBlock = { isShadow: function() {}};
- const nextBlock = { isShadow: function() {}};
- const outBlock = { isShadow: function() {}};
- const inBlock = { isShadow: function() {}};
+ const prevBlock = {isShadow: function() {}};
+ const nextBlock = {isShadow: function() {}};
+ const outBlock = {isShadow: function() {}};
+ const inBlock = {isShadow: function() {}};
this.previous = new Blockly.Connection(
prevBlock, Blockly.PREVIOUS_STATEMENT);
this.next = new Blockly.Connection(
@@ -161,8 +161,8 @@ suite('Connection checker', function() {
});
suite('Shadows', function() {
test('Previous Shadow', function() {
- const prevBlock = { isShadow: function() { return true; }};
- const nextBlock = { isShadow: function() { return false; }};
+ const prevBlock = {isShadow: function() {return true;}};
+ const nextBlock = {isShadow: function() {return false;}};
const prev = new Blockly.Connection(prevBlock, Blockly.PREVIOUS_STATEMENT);
const next = new Blockly.Connection(nextBlock, Blockly.NEXT_STATEMENT);
@@ -173,8 +173,8 @@ suite('Connection checker', function() {
Blockly.Connection.CAN_CONNECT);
});
test('Next Shadow', function() {
- const prevBlock = { isShadow: function() { return false; }};
- const nextBlock = { isShadow: function() { return true; }};
+ const prevBlock = {isShadow: function() {return false;}};
+ const nextBlock = {isShadow: function() {return true;}};
const prev = new Blockly.Connection(prevBlock, Blockly.PREVIOUS_STATEMENT);
const next = new Blockly.Connection(nextBlock, Blockly.NEXT_STATEMENT);
@@ -185,8 +185,8 @@ suite('Connection checker', function() {
Blockly.Connection.REASON_SHADOW_PARENT);
});
test('Prev and Next Shadow', function() {
- const prevBlock = { isShadow: function() { return true; }};
- const nextBlock = { isShadow: function() { return true; }};
+ const prevBlock = {isShadow: function() {return true;}};
+ const nextBlock = {isShadow: function() {return true;}};
const prev = new Blockly.Connection(prevBlock, Blockly.PREVIOUS_STATEMENT);
const next = new Blockly.Connection(nextBlock, Blockly.NEXT_STATEMENT);
@@ -197,8 +197,8 @@ suite('Connection checker', function() {
Blockly.Connection.CAN_CONNECT);
});
test('Output Shadow', function() {
- const outBlock = { isShadow: function() { return true; }};
- const inBlock = { isShadow: function() { return false; }};
+ const outBlock = {isShadow: function() {return true;}};
+ const inBlock = {isShadow: function() {return false;}};
const outCon = new Blockly.Connection(outBlock, Blockly.OUTPUT_VALUE);
const inCon = new Blockly.Connection(inBlock, Blockly.INPUT_VALUE);
@@ -209,8 +209,8 @@ suite('Connection checker', function() {
Blockly.Connection.CAN_CONNECT);
});
test('Input Shadow', function() {
- const outBlock = { isShadow: function() { return false; }};
- const inBlock = { isShadow: function() { return true; }};
+ const outBlock = {isShadow: function() {return false;}};
+ const inBlock = {isShadow: function() {return true;}};
const outCon = new Blockly.Connection(outBlock, Blockly.OUTPUT_VALUE);
const inCon = new Blockly.Connection(inBlock, Blockly.INPUT_VALUE);
@@ -221,8 +221,8 @@ suite('Connection checker', function() {
Blockly.Connection.REASON_SHADOW_PARENT);
});
test('Output and Input Shadow', function() {
- const outBlock = { isShadow: function() { return true; }};
- const inBlock = { isShadow: function() { return true; }};
+ const outBlock = {isShadow: function() {return true;}};
+ const inBlock = {isShadow: function() {return true;}};
const outCon = new Blockly.Connection(outBlock, Blockly.OUTPUT_VALUE);
const inCon = new Blockly.Connection(inBlock, Blockly.INPUT_VALUE);
diff --git a/tests/mocha/connection_db_test.js b/tests/mocha/connection_db_test.js
index aa64768d3..4936d703d 100644
--- a/tests/mocha/connection_db_test.js
+++ b/tests/mocha/connection_db_test.js
@@ -23,7 +23,7 @@ suite('Connection Database', function() {
};
this.createConnection = function(x, y, type, opt_database) {
const workspace = {
- connectionDBList: []
+ connectionDBList: [],
};
workspace.connectionDBList[type] = opt_database || this.database;
const connection = new Blockly.RenderedConnection(
@@ -68,7 +68,6 @@ suite('Connection Database', function() {
this.database.addConnection(y3b, 3);
chai.assert.sameOrderedMembers(
this.database.connections_, [y1, y2, y3b, y3a, y4]);
-
});
test('Remove Connection', function() {
const y2 = {y: 2};
diff --git a/tests/mocha/connection_test.js b/tests/mocha/connection_test.js
index 5f48e5a27..f7dd29dcd 100644
--- a/tests/mocha/connection_test.js
+++ b/tests/mocha/connection_test.js
@@ -17,7 +17,7 @@ suite('Connection', function() {
this.createConnection = function(type) {
const block = {
workspace: this.workspace,
- isShadow: function() { return false; }
+ isShadow: function() {return false;},
};
const connection = new Blockly.Connection(block, type);
return connection;
@@ -71,7 +71,6 @@ suite('Connection', function() {
});
suite('Set Shadow', function() {
-
function assertBlockMatches(block, isShadow, opt_id) {
chai.assert.equal(block.isShadow(), isShadow,
`expected block ${block.id} to ${isShadow ? '' : 'not'} be a shadow`);
@@ -126,7 +125,7 @@ suite('Connection', function() {
createWorkspace: () => {
return new Blockly.Workspace();
},
- }
+ },
];
testSuites.forEach((testSuite) => {
@@ -188,9 +187,9 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': 'id1',
- }
- }
- }
+ },
+ },
+ },
},
'' +
@@ -229,12 +228,12 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': 'id2',
- }
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
+ },
},
'' +
@@ -266,9 +265,9 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'id1',
- }
- }
- }
+ },
+ },
+ },
},
'' +
@@ -307,12 +306,12 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'id2',
- }
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
+ },
},
'' +
@@ -343,8 +342,8 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'id1',
- }
- }
+ },
+ },
},
'' +
@@ -380,10 +379,10 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'id2',
- }
- }
- }
- }
+ },
+ },
+ },
+ },
},
'' +
@@ -453,9 +452,9 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': 'id1',
- }
- }
- }
+ },
+ },
+ },
},
'' +
@@ -497,12 +496,12 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': 'id2',
- }
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
+ },
},
'' +
@@ -536,9 +535,9 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'id1',
- }
- }
- }
+ },
+ },
+ },
},
'' +
@@ -581,12 +580,12 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'id2',
- }
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
+ },
},
'' +
@@ -619,8 +618,8 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'id1',
- }
- }
+ },
+ },
},
'' +
@@ -659,10 +658,10 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'id2',
- }
- }
- }
- }
+ },
+ },
+ },
+ },
},
'' +
@@ -722,9 +721,9 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': '2',
- }
- }
- }
+ },
+ },
+ },
},
'' +
@@ -772,12 +771,12 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': 'b',
- }
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
+ },
},
'' +
@@ -812,9 +811,9 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': '2',
- }
- }
- }
+ },
+ },
+ },
},
'' +
@@ -862,12 +861,12 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'b',
- }
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
+ },
},
'' +
@@ -901,8 +900,8 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': '2',
- }
- }
+ },
+ },
},
'' +
@@ -946,10 +945,10 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'b',
- }
- }
- }
- }
+ },
+ },
+ },
+ },
},
'' +
@@ -1327,7 +1326,7 @@ suite('Connection', function() {
"type": "stack_checks_block",
"message0": "",
"previousStatement": "check 1",
- "nextStatement": "check 2"
+ "nextStatement": "check 2",
}]);
const block = this.workspace.newBlock('stack_checks_block');
chai.assert.throws(() =>
@@ -1370,9 +1369,9 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': 'id1',
- }
- }
- }
+ },
+ },
+ },
},
'' +
@@ -1392,10 +1391,10 @@ suite('Connection', function() {
'INPUT': {
'shadow': {
'type': 'row_block',
- 'id': 'id2'
- }
- }
- }
+ 'id': 'id2',
+ },
+ },
+ },
});
assertInputHasBlock(parent, 'INPUT', true);
assertInputHasBlock(
@@ -1415,12 +1414,12 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': 'id2',
- }
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
+ },
},
'' +
@@ -1450,9 +1449,9 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'id1',
- }
- }
- }
+ },
+ },
+ },
},
'' +
@@ -1473,9 +1472,9 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'id2',
- }
- }
- }
+ },
+ },
+ },
});
assertInputHasBlock(parent, 'NAME', true);
assertInputHasBlock(
@@ -1495,12 +1494,12 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'id2',
- }
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
+ },
},
'' +
@@ -1529,8 +1528,8 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'id1',
- }
- }
+ },
+ },
},
'' +
@@ -1549,8 +1548,8 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'id2',
- }
- }
+ },
+ },
});
assertNextHasBlock(parent, true);
assertNextHasBlock(parent.getNextBlock(), true);
@@ -1567,10 +1566,10 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'id2',
- }
- }
- }
- }
+ },
+ },
+ },
+ },
},
'' +
@@ -1597,10 +1596,10 @@ suite('Connection', function() {
'INPUT': {
'block': {
'type': 'row_block',
- 'id': 'idA'
- }
- }
- }
+ 'id': 'idA',
+ },
+ },
+ },
},
workspace);
}
@@ -1614,10 +1613,10 @@ suite('Connection', function() {
'NAME': {
'block': {
'type': 'statement_block',
- 'id': 'idA'
- }
- }
- }
+ 'id': 'idA',
+ },
+ },
+ },
},
workspace);
}
@@ -1630,9 +1629,9 @@ suite('Connection', function() {
'next': {
'block': {
'type': 'stack_block',
- 'id': 'idA'
- }
- }
+ 'id': 'idA',
+ },
+ },
},
workspace);
}
@@ -1654,9 +1653,9 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': 'id1',
- }
- }
- }
+ },
+ },
+ },
},
'' +
@@ -1678,9 +1677,9 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': 'id2',
- }
- }
- }
+ },
+ },
+ },
}
);
assertInputHasBlock(parent, 'INPUT', false);
@@ -1704,12 +1703,12 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': 'id2',
- }
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
+ },
},
'' +
@@ -1741,9 +1740,9 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'id1',
- }
- }
- }
+ },
+ },
+ },
},
'' +
@@ -1765,9 +1764,9 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'id2',
- }
- }
- }
+ },
+ },
+ },
}
);
assertInputHasBlock(parent, 'NAME', false);
@@ -1792,12 +1791,12 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'id2',
- }
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
+ },
},
'' +
@@ -1828,8 +1827,8 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'id1',
- }
- }
+ },
+ },
},
'' +
@@ -1850,8 +1849,8 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'id2',
- }
- }
+ },
+ },
}
);
assertNextHasBlock(parent, false);
@@ -1872,10 +1871,10 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'id2',
- }
- }
- }
- }
+ },
+ },
+ },
+ },
},
'' +
@@ -1926,9 +1925,9 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': '2',
- }
- }
- }
+ },
+ },
+ },
},
'' +
@@ -1950,9 +1949,9 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': 'a',
- }
- }
- }
+ },
+ },
+ },
}
);
assertInputHasBlock(parent, 'INPUT', true, '1');
@@ -1967,9 +1966,9 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': 'b',
- }
- }
- }
+ },
+ },
+ },
}
);
assertInputHasBlock(parent, 'INPUT', true, '2');
@@ -1990,12 +1989,12 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': 'b',
- }
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
+ },
},
'' +
@@ -2028,9 +2027,9 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': '2',
- }
- }
- }
+ },
+ },
+ },
},
'' +
@@ -2052,9 +2051,9 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'a',
- }
- }
- }
+ },
+ },
+ },
}
);
assertInputHasBlock(parent, 'NAME', true, '1');
@@ -2069,9 +2068,9 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'b',
- }
- }
- }
+ },
+ },
+ },
}
);
assertInputHasBlock(parent, 'NAME', true, '2');
@@ -2092,12 +2091,12 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'b',
- }
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
+ },
},
'' +
@@ -2129,8 +2128,8 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': '2',
- }
- }
+ },
+ },
},
'' +
@@ -2151,8 +2150,8 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'a',
- }
- }
+ },
+ },
}
);
assertNextHasBlock(parent, true, '1');
@@ -2165,8 +2164,8 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'b',
- }
- }
+ },
+ },
}
);
assertNextHasBlock(parent, true, '2');
@@ -2184,10 +2183,10 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'b',
- }
- }
- }
- }
+ },
+ },
+ },
+ },
},
'' +
@@ -2215,9 +2214,9 @@ suite('Connection', function() {
'shadow': {
'type': 'row_block',
'id': 'id1',
- }
- }
- }
+ },
+ },
+ },
},
workspace);
}
@@ -2232,9 +2231,9 @@ suite('Connection', function() {
'shadow': {
'type': 'statement_block',
'id': 'id1',
- }
- }
- }
+ },
+ },
+ },
},
workspace);
}
@@ -2248,8 +2247,8 @@ suite('Connection', function() {
'shadow': {
'type': 'stack_block',
'id': 'id1',
- }
- }
+ },
+ },
},
workspace);
}
@@ -2319,9 +2318,9 @@ suite('Connection', function() {
'block': {
'type': 'row_block',
'id': 'id2',
- }
- }
- }
+ },
+ },
+ },
},
workspace);
}
@@ -2340,9 +2339,9 @@ suite('Connection', function() {
'block': {
'type': 'statement_block',
'id': 'id2',
- }
- }
- }
+ },
+ },
+ },
},
workspace);
}
@@ -2360,8 +2359,8 @@ suite('Connection', function() {
'block': {
'type': 'stack_block',
'id': 'id2',
- }
- }
+ },
+ },
},
workspace);
}
@@ -2460,9 +2459,9 @@ suite('Connection', function() {
'INPUT': {
'shadow': {
'type': 'row_block',
- }
- }
- }
+ },
+ },
+ },
});
assertInputHasBlock(parent, 'INPUT', true);
assertInputHasBlock(
@@ -2501,9 +2500,9 @@ suite('Connection', function() {
'NAME': {
'shadow': {
'type': 'statement_block',
- }
- }
- }
+ },
+ },
+ },
});
assertInputHasBlock(parent, 'NAME', true);
assertInputHasBlock(
@@ -2538,9 +2537,9 @@ suite('Connection', function() {
'type': 'stack_block',
'next': {
'shadow': {
- 'type': 'stack_block'
- }
- }
+ 'type': 'stack_block',
+ },
+ },
});
assertNextHasBlock(parent, true);
assertNextHasBlock(parent.getNextBlock(), true);
@@ -2593,7 +2592,7 @@ suite('Connection', function() {
"type": "stack_checks_block",
"message0": "",
"previousStatement": "check 1",
- "nextStatement": "check 2"
+ "nextStatement": "check 2",
}]);
const block = this.workspace.newBlock('stack_checks_block');
chai.assert.throws(() =>
@@ -2617,23 +2616,23 @@ suite('Connection', function() {
{
"type": "field_input",
"name": "FIELD",
- "text": "default"
- }
+ "text": "default",
+ },
],
"previousStatement": 'check1',
- "nextStatement": 'check1'
+ "nextStatement": 'check1',
},
{
"type": "stack_block_1to2",
"message0": "",
"previousStatement": 'check1',
- "nextStatement": 'check2'
+ "nextStatement": 'check2',
},
{
"type": "stack_block_2to1",
"message0": "",
"previousStatement": 'check2',
- "nextStatement": 'check1'
+ "nextStatement": 'check1',
},
{
"type": "stack_block_noend",
@@ -2647,15 +2646,15 @@ suite('Connection', function() {
{
"type": "field_input",
"name": "FIELD",
- "text": "default"
+ "text": "default",
},
{
"type": "input_value",
"name": "INPUT",
- "check": 'check1'
- }
+ "check": 'check1',
+ },
],
- "output": 'check1'
+ "output": 'check1',
},
{
"type": "row_block_1to2",
@@ -2664,10 +2663,10 @@ suite('Connection', function() {
{
"type": "input_value",
"name": "INPUT",
- "check": 'check1'
- }
+ "check": 'check1',
+ },
],
- "output": 'check2'
+ "output": 'check2',
},
{
"type": "row_block_2to1",
@@ -2676,15 +2675,15 @@ suite('Connection', function() {
{
"type": "input_value",
"name": "INPUT",
- "check": 'check2'
- }
+ "check": 'check2',
+ },
],
- "output": 'check1'
+ "output": 'check1',
},
{
"type": "row_block_noend",
"message0": "",
- "output": 'check1'
+ "output": 'check1',
},
{
"type": "row_block_multiple_inputs",
@@ -2693,15 +2692,15 @@ suite('Connection', function() {
{
"type": "input_value",
"name": "INPUT",
- "check": 'check1'
+ "check": 'check1',
},
{
"type": "input_value",
"name": "INPUT2",
- "check": 'check1'
- }
+ "check": 'check1',
+ },
],
- "output": 'check1'
+ "output": 'check1',
},
{
'type': 'output_to_statements',
@@ -2710,13 +2709,13 @@ suite('Connection', function() {
{
'type': 'input_statement',
'name': 'INPUT',
- 'check': 'check1'
+ 'check': 'check1',
},
{
'type': 'input_statement',
'name': 'INPUT2',
- 'check': 'check1'
- }
+ 'check': 'check1',
+ },
],
'output': 'check1',
},
@@ -2727,16 +2726,16 @@ suite('Connection', function() {
{
"type": "field_input",
"name": "FIELD",
- "text": "default"
+ "text": "default",
},
{
"type": "input_statement",
"name": "NAME",
- "check": 'check1'
- }
+ "check": 'check1',
+ },
],
"previousStatement": 'check1',
- "nextStatement": 'check1'
+ "nextStatement": 'check1',
},
{
"type": "statement_block_1to2",
@@ -2745,11 +2744,11 @@ suite('Connection', function() {
{
"type": "input_statement",
"name": "NAME",
- "check": 'check1'
- }
+ "check": 'check1',
+ },
],
"previousStatement": 'check1',
- "nextStatement": 'check2'
+ "nextStatement": 'check2',
},
{
"type": "statement_block_2to1",
@@ -2758,11 +2757,11 @@ suite('Connection', function() {
{
"type": "input_statement",
"name": "NAME",
- "check": 'check2'
- }
+ "check": 'check2',
+ },
],
"previousStatement": 'check2',
- "nextStatement": 'check1'
+ "nextStatement": 'check1',
},
{
"type": "statement_block_noend",
@@ -2771,8 +2770,8 @@ suite('Connection', function() {
{
"type": "input_statement",
"name": "NAME",
- "check": 'check1'
- }
+ "check": 'check1',
+ },
],
"previousStatement": 'check1',
},
diff --git a/tests/mocha/cursor_test.js b/tests/mocha/cursor_test.js
index 1a3306d08..a86268d87 100644
--- a/tests/mocha/cursor_test.js
+++ b/tests/mocha/cursor_test.js
@@ -20,27 +20,27 @@ suite('Cursor', function() {
{
"type": "field_input",
"name": "NAME",
- "text": "default"
+ "text": "default",
},
{
"type": "field_input",
"name": "NAME",
- "text": "default"
+ "text": "default",
},
{
"type": "input_value",
- "name": "NAME"
+ "name": "NAME",
},
{
"type": "input_statement",
- "name": "NAME"
- }
+ "name": "NAME",
+ },
],
"previousStatement": null,
"nextStatement": null,
"colour": 230,
"tooltip": "",
- "helpUrl": ""
+ "helpUrl": "",
},
{
"type": "field_input",
@@ -49,14 +49,14 @@ suite('Cursor', function() {
{
"type": "field_input",
"name": "NAME",
- "text": "default"
- }
+ "text": "default",
+ },
],
"output": null,
"colour": 230,
"tooltip": "",
- "helpUrl": ""
- }
+ "helpUrl": "",
+ },
]);
this.workspace = Blockly.inject('blocklyDiv', {});
this.cursor = this.workspace.getCursor();
@@ -75,7 +75,7 @@ suite('Cursor', function() {
B: blockB,
C: blockC,
D: blockD,
- E: blockE
+ E: blockE,
};
});
teardown(function() {
diff --git a/tests/mocha/dropdowndiv_test.js b/tests/mocha/dropdowndiv_test.js
index 64b1f6230..c45aee795 100644
--- a/tests/mocha/dropdowndiv_test.js
+++ b/tests/mocha/dropdowndiv_test.js
@@ -20,17 +20,17 @@ suite('DropDownDiv', function() {
top: 0,
bottom: 100,
width: 100,
- height: 100
+ height: 100,
});
this.sizeStub = sinon.stub(Blockly.utils.style, 'getSize')
.returns({
width: 60,
- height: 60
+ height: 60,
});
this.clientHeightStub = sinon.stub(document.documentElement, 'clientHeight')
- .get(function() { return 1000; });
+ .get(function() {return 1000;});
this.clientTopStub = sinon.stub(document.documentElement, 'clientTop')
- .get(function() { return 0; });
+ .get(function() {return 0;});
});
teardown(function() {
sharedTestTeardown.call(this);
@@ -68,7 +68,7 @@ suite('DropDownDiv', function() {
chai.assert.isFalse(metrics.arrowAtTop);
});
test('No Solution, Render At Top', function() {
- this.clientHeightStub.get(function() { return 100; });
+ this.clientHeightStub.get(function() {return 100;});
const metrics = Blockly.DropDownDiv.TEST_ONLY.getPositionMetrics(50, 60, 50, 50);
// "Above" in value actually means below in render.
chai.assert.equal(metrics.initialY, 0);
diff --git a/tests/mocha/event_test.js b/tests/mocha/event_test.js
index 2641ef12d..c975fc05d 100644
--- a/tests/mocha/event_test.js
+++ b/tests/mocha/event_test.js
@@ -24,13 +24,13 @@ suite('Events', function() {
{
'type': 'field_variable',
'name': 'VAR',
- 'variable': 'item'
- }
+ 'variable': 'item',
+ },
],
},
{
'type': 'simple_test_block',
- 'message0': 'simple test block'
+ 'message0': 'simple test block',
}]);
});
@@ -60,7 +60,7 @@ suite('Events', function() {
const event = new Blockly.Events.Abstract();
assertEventEquals(event, undefined, undefined, undefined, {
'recordUndo': true,
- 'group': ''
+ 'group': '',
});
});
@@ -77,7 +77,7 @@ suite('Events', function() {
assertEventEquals(event, Blockly.Events.CLICK, this.workspace.id, null, {
'targetType': 'workspace',
'recordUndo': false,
- 'group': ''
+ 'group': '',
}, true);
});
@@ -90,7 +90,7 @@ suite('Events', function() {
'oldValue': 'bar',
'newValue': 'baz',
'recordUndo': false,
- 'group': TEST_GROUP_ID
+ 'group': TEST_GROUP_ID,
}, true);
});
@@ -150,7 +150,7 @@ suite('Events', function() {
'oldValue': 'bar',
'newValue': 'baz',
'recordUndo': false,
- 'group': TEST_GROUP_ID
+ 'group': TEST_GROUP_ID,
}, true);
});
@@ -162,7 +162,7 @@ suite('Events', function() {
this.TEST_BLOCK_ID, {
'targetType': 'block',
'recordUndo': false,
- 'group': TEST_GROUP_ID
+ 'group': TEST_GROUP_ID,
}, true);
});
@@ -179,7 +179,7 @@ suite('Events', function() {
'oldInputName': undefined,
'oldCoordinate': coordinate,
'recordUndo': true,
- 'group': ''
+ 'group': '',
});
});
@@ -196,7 +196,7 @@ suite('Events', function() {
'oldInputName': undefined,
'oldCoordinate': undefined,
'recordUndo': true,
- 'group': ''
+ 'group': '',
});
} finally {
// This needs to be cleared, otherwise workspace.dispose will fail.
@@ -282,7 +282,7 @@ suite('Events', function() {
'oldInputName': undefined,
'oldCoordinate': undefined,
'recordUndo': false,
- 'group': ''
+ 'group': '',
});
} finally {
// This needs to be cleared, otherwise workspace.dispose will fail.
@@ -312,7 +312,7 @@ suite('Events', function() {
'oldValue': 'id1',
'newValue': 'id2',
'recordUndo': true,
- 'group': ''
+ 'group': '',
});
});
});
@@ -449,8 +449,8 @@ suite('Events', function() {
blockId: thisObj.block.id,
element: 'collapsed',
oldValue: false,
- newValue: true
- })
+ newValue: true,
+ }),
},
{
title: 'Block create',
@@ -469,7 +469,7 @@ suite('Events', function() {
'x': 0,
'y': 0,
},
- })
+ }),
},
{
title: 'Block create (shadow)',
@@ -488,8 +488,8 @@ suite('Events', function() {
'x': 0,
'y': 0,
},
- recordUndo: false
- })
+ recordUndo: false,
+ }),
},
{
title: 'Block delete',
@@ -509,7 +509,7 @@ suite('Events', function() {
'x': 0,
'y': 0,
},
- })
+ }),
},
{
title: 'Block delete (shadow)',
@@ -529,8 +529,8 @@ suite('Events', function() {
'x': 0,
'y': 0,
},
- recordUndo: false
- })
+ recordUndo: false,
+ }),
},
// TODO(#4577) Test serialization of move event coordinate properties.
{
@@ -539,8 +539,8 @@ suite('Events', function() {
getArgs: (thisObj) => [thisObj.block],
getExpectedJson: (thisObj) => ({
type: 'move',
- blockId: thisObj.block.id
- })
+ blockId: thisObj.block.id,
+ }),
},
{
title: 'Block move (shadow)',
@@ -549,8 +549,8 @@ suite('Events', function() {
getExpectedJson: (thisObj) => ({
type: 'move',
blockId: thisObj.shadowBlock.id,
- recordUndo: false
- })
+ recordUndo: false,
+ }),
},
];
const workspaceEventTestCases = [
@@ -670,7 +670,7 @@ suite('Events', function() {
assertEventEquals(event, undefined, this.workspace.id, undefined, {
'varId': 'id1',
'recordUndo': true,
- 'group': ''
+ 'group': '',
});
});
@@ -683,7 +683,7 @@ suite('Events', function() {
'varType': 'type1',
'varName': 'name1',
'recordUndo': true,
- 'group': ''
+ 'group': '',
});
});
@@ -696,7 +696,7 @@ suite('Events', function() {
'varType': 'type1',
'varName': 'name1',
'recordUndo': true,
- 'group': ''
+ 'group': '',
});
});
@@ -709,7 +709,7 @@ suite('Events', function() {
'oldName': 'name1',
'newName': 'name2',
'recordUndo': true,
- 'group': ''
+ 'group': '',
});
});
});
@@ -783,7 +783,7 @@ suite('Events', function() {
new Blockly.Events.BlockCreate(block),
new Blockly.Events.BlockMove(block),
new Blockly.Events.BlockChange(block, 'field', 'VAR', 'id1', 'id2'),
- new Blockly.Events.Click(block)
+ new Blockly.Events.Click(block),
];
const filteredEvents = eventUtils.filter(events, true);
chai.assert.equal(filteredEvents.length, 4); // no event should have been removed.
@@ -801,7 +801,7 @@ suite('Events', function() {
new Blockly.Events.BlockCreate(block1),
new Blockly.Events.BlockMove(block1),
new Blockly.Events.BlockCreate(block2),
- new Blockly.Events.BlockMove(block2)
+ new Blockly.Events.BlockMove(block2),
];
const filteredEvents = eventUtils.filter(events, true);
chai.assert.equal(filteredEvents.length, 4); // no event should have been removed.
@@ -809,7 +809,7 @@ suite('Events', function() {
test('Forward', function() {
const block = this.workspace.newBlock('field_variable_test_block', '1');
- const events = [ new Blockly.Events.BlockCreate(block) ];
+ const events = [new Blockly.Events.BlockCreate(block)];
addMoveEvent(events, block, 1, 1);
addMoveEvent(events, block, 2, 2);
addMoveEvent(events, block, 3, 3);
@@ -824,7 +824,7 @@ suite('Events', function() {
test('Backward', function() {
const block = this.workspace.newBlock('field_variable_test_block', '1');
- const events = [ new Blockly.Events.BlockCreate(block) ];
+ const events = [new Blockly.Events.BlockCreate(block)];
addMoveEvent(events, block, 1, 1);
addMoveEvent(events, block, 2, 2);
addMoveEvent(events, block, 3, 3);
@@ -852,7 +852,7 @@ suite('Events', function() {
const block1 = this.workspace.newBlock('field_variable_test_block', '1');
const events = [
new Blockly.Events.BlockChange(block1, 'field', 'VAR', 'item', 'item1'),
- new Blockly.Events.BlockChange(block1, 'field', 'VAR', 'item1', 'item2')
+ new Blockly.Events.BlockChange(block1, 'field', 'VAR', 'item1', 'item2'),
];
const filteredEvents = eventUtils.filter(events, true);
chai.assert.equal(filteredEvents.length, 1); // second change event merged into first
@@ -863,7 +863,7 @@ suite('Events', function() {
test('Merge viewport change events', function() {
const events = [
new Blockly.Events.ViewportChange(1, 2, 3, this.workspace, 4),
- new Blockly.Events.ViewportChange(5, 6, 7, this.workspace, 8)
+ new Blockly.Events.ViewportChange(5, 6, 7, this.workspace, 8),
];
const filteredEvents = eventUtils.filter(events, true);
chai.assert.equal(filteredEvents.length, 1); // second change event merged into first
@@ -883,7 +883,7 @@ suite('Events', function() {
new Blockly.Events.BubbleOpen(block2, true, 'mutator'),
new Blockly.Events.Click(block2),
new Blockly.Events.BubbleOpen(block3, true, 'warning'),
- new Blockly.Events.Click(block3)
+ new Blockly.Events.Click(block3),
];
const filteredEvents = eventUtils.filter(events, true);
// click event merged into corresponding *Open event
@@ -902,7 +902,7 @@ suite('Events', function() {
const block = this.workspace.newBlock('field_variable_test_block', '1');
const events = [
new Blockly.Events.Click(block),
- new Blockly.Events.Ui(block, 'stackclick', undefined, undefined)
+ new Blockly.Events.Ui(block, 'stackclick', undefined, undefined),
];
const filteredEvents = eventUtils.filter(events, true);
// click and stackclick should both exist
diff --git a/tests/mocha/extensions_test.js b/tests/mocha/extensions_test.js
index fb9a67635..d4aebf38e 100644
--- a/tests/mocha/extensions_test.js
+++ b/tests/mocha/extensions_test.js
@@ -36,7 +36,7 @@ suite('Extensions', function() {
Blockly.defineBlocksWithJsonArray([{
"type": "extension_test_block",
"message0": "extension_test_block",
- "extensions": ["extensions_test_before", "extensions_test_after"]
+ "extensions": ["extensions_test_before", "extensions_test_after"],
}]);
chai.assert.isUndefined(
@@ -71,7 +71,7 @@ suite('Extensions', function() {
"message0": "test_parent_tooltip_when_inline",
"output": true,
"tooltip": defaultTooltip,
- "extensions": ["parent_tooltip_when_inline"]
+ "extensions": ["parent_tooltip_when_inline"],
},
{
"type": "test_parent",
@@ -79,11 +79,11 @@ suite('Extensions', function() {
"args0": [
{
"type": "input_value",
- "name": "INPUT"
- }
+ "name": "INPUT",
+ },
],
- "tooltip": parentTooltip
- }
+ "tooltip": parentTooltip,
+ },
]);
const block =
@@ -121,7 +121,7 @@ suite('Extensions', function() {
field: 'FIELD',
method: function() {
console.log('TEXT_MIXIN method()');
- }
+ },
};
chai.assert.isUndefined(
@@ -136,7 +136,7 @@ suite('Extensions', function() {
Blockly.defineBlocksWithJsonArray([{
"type": "test_block_mixin",
"message0": "test_block_mixin",
- "extensions": ["mixin_test"]
+ "extensions": ["mixin_test"],
}]);
const block = new Blockly.Block(this.workspace, 'test_block_mixin');
@@ -152,7 +152,7 @@ suite('Extensions', function() {
Blockly.defineBlocksWithJsonArray([{
"type": "mutator_test_block",
"message0": "mutator_test_block",
- "mutator": "mutator_test"
+ "mutator": "mutator_test",
}]);
// Events code calls mutationToDom and expects it to give back a meaningful
@@ -171,7 +171,7 @@ suite('Extensions', function() {
},
decompose: function() {
return 'decomposeFn';
- }
+ },
});
const block = new Blockly.Block(this.workspace, 'mutator_test_block');
@@ -189,7 +189,7 @@ suite('Extensions', function() {
Blockly.defineBlocksWithJsonArray([{
"type": "mutator_test_block",
"message0": "mutator_test_block",
- "mutator": ["extensions_test"]
+ "mutator": ["extensions_test"],
}]);
// Events code calls mutationToDom and expects it to give back a
@@ -205,7 +205,7 @@ suite('Extensions', function() {
},
mutationToDom: function() {
return 'mutationToDomFn';
- }
+ },
},
helperFunctionSpy
);
@@ -221,7 +221,7 @@ suite('Extensions', function() {
Blockly.defineBlocksWithJsonArray([{
"type": "mutator_test_block",
"message0": "mutator_test_block",
- "mutator": "mutator_test"
+ "mutator": "mutator_test",
}]);
// Events code calls mutationToDom and expects it to give back a
@@ -236,7 +236,7 @@ suite('Extensions', function() {
},
mutationToDom: function() {
return 'mutationToDomFn';
- }
+ },
});
const block = new Blockly.Block(this.workspace, 'mutator_test_block');
@@ -255,7 +255,7 @@ suite('Extensions', function() {
Blockly.defineBlocksWithJsonArray([{
"type": "missing_extension_block",
"message0": "missing_extension_block",
- "extensions": ["missing_extension"]
+ "extensions": ["missing_extension"],
}]);
chai.assert.isUndefined(
@@ -270,7 +270,7 @@ suite('Extensions', function() {
this.extensionsCleanup_.push('mixin_bad_inputList');
const TEST_MIXIN_BAD_INPUTLIST = {
- inputList: 'bad inputList' // Defined in constructor
+ inputList: 'bad inputList', // Defined in constructor
};
chai.assert.isUndefined(
@@ -285,7 +285,7 @@ suite('Extensions', function() {
Blockly.defineBlocksWithJsonArray([{
"type": "test_block_bad_inputList",
"message0": "test_block_bad_inputList",
- "extensions": ["mixin_bad_inputList"]
+ "extensions": ["mixin_bad_inputList"],
}]);
const workspace = this.workspace;
@@ -298,7 +298,7 @@ suite('Extensions', function() {
this.extensionsCleanup_.push('mixin_bad_colour_');
const TEST_MIXIN_BAD_COLOUR = {
- colour_: 'bad colour_' // Defined on prototype
+ colour_: 'bad colour_', // Defined on prototype
};
chai.assert.isUndefined(
@@ -313,7 +313,7 @@ suite('Extensions', function() {
Blockly.defineBlocksWithJsonArray([{
"type": "test_block_bad_colour",
"message0": "test_block_bad_colour",
- "extensions": ["mixin_bad_colour_"]
+ "extensions": ["mixin_bad_colour_"],
}]);
const workspace = this.workspace;
@@ -328,7 +328,7 @@ suite('Extensions', function() {
Blockly.defineBlocksWithJsonArray([{
"type": "mutator_test_block",
"message0": "mutator_test_block",
- "extensions": ["mutator_test"]
+ "extensions": ["mutator_test"],
}]);
// Events code calls mutationToDom and expects it to give back a
@@ -343,7 +343,7 @@ suite('Extensions', function() {
},
mutationToDom: function() {
return 'mutationToDomFn';
- }
+ },
});
const workspace = this.workspace;
@@ -361,7 +361,7 @@ suite('Extensions', function() {
Blockly.defineBlocksWithJsonArray([{
"type": "mutator_test_block",
"message0": "mutator_test_block",
- "extensions": ["mutator_test"]
+ "extensions": ["mutator_test"],
}]);
// Events code calls mutationToDom and expects it to give back a
@@ -376,7 +376,7 @@ suite('Extensions', function() {
},
mutationToDom: function() {
return 'mutationToDomFn';
- }
+ },
});
const workspace = this.workspace;
@@ -394,7 +394,7 @@ suite('Extensions', function() {
Blockly.defineBlocksWithJsonArray([{
"type": "mutator_test_block",
"message0": "mutator_test_block",
- "mutator": ["extensions_test"]
+ "mutator": ["extensions_test"],
}]);
// Events code calls mutationToDom and expects it to give back a
@@ -458,7 +458,7 @@ suite('Extensions', function() {
},
decompose: function() {
return 'decomposeFn';
- }
+ },
});
}, /domToMutation/);
});
@@ -476,7 +476,7 @@ suite('Extensions', function() {
},
decompose: function() {
return 'decomposeFn';
- }
+ },
});
}, /mutationToDom/);
});
@@ -494,7 +494,7 @@ suite('Extensions', function() {
},
decompose: function() {
return 'decomposeFn';
- }
+ },
});
}, /saveExtraState/);
});
@@ -512,7 +512,7 @@ suite('Extensions', function() {
},
decompose: function() {
return 'decomposeFn';
- }
+ },
});
}, /loadExtraState/);
});
@@ -527,7 +527,7 @@ suite('Extensions', function() {
},
decompose: function() {
return 'decomposeFn';
- }
+ },
});
}, 'Mutations must contain either XML hooks, or JSON hooks, or both');
});
@@ -545,7 +545,7 @@ suite('Extensions', function() {
},
decompose: function() {
return 'decomposeFn';
- }
+ },
});
}, /compose/);
});
@@ -563,7 +563,7 @@ suite('Extensions', function() {
},
compose: function() {
return 'composeFn';
- }
+ },
});
}, /decompose/);
});
diff --git a/tests/mocha/field_angle_test.js b/tests/mocha/field_angle_test.js
index a57ad7546..2d3736e67 100644
--- a/tests/mocha/field_angle_test.js
+++ b/tests/mocha/field_angle_test.js
@@ -156,14 +156,14 @@ suite('Angle Fields', function() {
suite('Clockwise', function() {
test('JS Configuration', function() {
const field = new Blockly.FieldAngle(0, null, {
- clockwise: true
+ clockwise: true,
});
chai.assert.isTrue(field.clockwise_);
});
test('JSON Definition', function() {
const field = Blockly.FieldAngle.fromJson({
value: 0,
- clockwise: true
+ clockwise: true,
});
chai.assert.isTrue(field.clockwise_);
});
@@ -179,14 +179,14 @@ suite('Angle Fields', function() {
suite('Offset', function() {
test('JS Configuration', function() {
const field = new Blockly.FieldAngle(0, null, {
- offset: 90
+ offset: 90,
});
chai.assert.equal(field.offset_, 90);
});
test('JSON Definition', function() {
const field = Blockly.FieldAngle.fromJson({
value: 0,
- offset: 90
+ offset: 90,
});
chai.assert.equal(field.offset_, 90);
});
@@ -205,7 +205,7 @@ suite('Angle Fields', function() {
Blockly.FieldAngle.OFFSET = 90;
const field = Blockly.FieldAngle.fromJson({
value: 0,
- offset: null
+ offset: null,
});
chai.assert.equal(field.offset_, 90);
});
@@ -213,14 +213,14 @@ suite('Angle Fields', function() {
suite('Wrap', function() {
test('JS Configuration', function() {
const field = new Blockly.FieldAngle(0, null, {
- wrap: 180
+ wrap: 180,
});
chai.assert.equal(field.wrap_, 180);
});
test('JSON Definition', function() {
const field = Blockly.FieldAngle.fromJson({
value: 0,
- wrap: 180
+ wrap: 180,
});
chai.assert.equal(field.wrap_, 180);
});
@@ -239,7 +239,7 @@ suite('Angle Fields', function() {
Blockly.FieldAngle.WRAP = 180;
const field = Blockly.FieldAngle.fromJson({
value: 0,
- wrap: null
+ wrap: null,
});
chai.assert.equal(field.wrap_, 180);
});
@@ -247,14 +247,14 @@ suite('Angle Fields', function() {
suite('Round', function() {
test('JS Configuration', function() {
const field = new Blockly.FieldAngle(0, null, {
- round: 30
+ round: 30,
});
chai.assert.equal(field.round_, 30);
});
test('JSON Definition', function() {
const field = Blockly.FieldAngle.fromJson({
value: 0,
- round: 30
+ round: 30,
});
chai.assert.equal(field.round_, 30);
});
@@ -273,7 +273,7 @@ suite('Angle Fields', function() {
Blockly.FieldAngle.ROUND = 30;
const field = Blockly.FieldAngle.fromJson({
value: 0,
- round: null
+ round: null,
});
chai.assert.equal(field.round_, 30);
});
@@ -282,7 +282,7 @@ suite('Angle Fields', function() {
suite('Compass', function() {
test('JS Configuration', function() {
const field = new Blockly.FieldAngle(0, null, {
- mode: 'compass'
+ mode: 'compass',
});
chai.assert.equal(field.offset_, 90);
chai.assert.isTrue(field.clockwise_);
@@ -290,7 +290,7 @@ suite('Angle Fields', function() {
test('JS Configuration', function() {
const field = Blockly.FieldAngle.fromJson({
value: 0,
- mode: 'compass'
+ mode: 'compass',
});
chai.assert.equal(field.offset_, 90);
chai.assert.isTrue(field.clockwise_);
@@ -299,7 +299,7 @@ suite('Angle Fields', function() {
suite('Protractor', function() {
test('JS Configuration', function() {
const field = new Blockly.FieldAngle(0, null, {
- mode: 'protractor'
+ mode: 'protractor',
});
chai.assert.equal(field.offset_, 0);
chai.assert.isFalse(field.clockwise_);
@@ -307,7 +307,7 @@ suite('Angle Fields', function() {
test('JS Configuration', function() {
const field = Blockly.FieldAngle.fromJson({
value: 0,
- mode: 'protractor'
+ mode: 'protractor',
});
chai.assert.equal(field.offset_, 0);
chai.assert.isFalse(field.clockwise_);
diff --git a/tests/mocha/field_checkbox_test.js b/tests/mocha/field_checkbox_test.js
index 24b8904a3..2c6b8eeb2 100644
--- a/tests/mocha/field_checkbox_test.js
+++ b/tests/mocha/field_checkbox_test.js
@@ -147,10 +147,10 @@ suite('Checkbox Fields', function() {
RTL: false,
rendered: true,
workspace: {
- keyboardAccessibilityMode: false
+ keyboardAccessibilityMode: false,
},
- render: function() { field.render_(); },
- bumpNeighbours: function() {}
+ render: function() {field.render_();},
+ bumpNeighbours: function() {},
};
field.constants_ = {
FIELD_CHECKBOX_X_OFFSET: 2,
@@ -176,13 +176,13 @@ suite('Checkbox Fields', function() {
});
test('JS Constructor', function() {
const field = new Blockly.FieldCheckbox(true, null, {
- checkCharacter: '\u2661'
+ checkCharacter: '\u2661',
});
assertCharacter(field, '\u2661');
});
test('JSON Definition', function() {
const field = Blockly.FieldCheckbox.fromJson({
- checkCharacter: '\u2661'
+ checkCharacter: '\u2661',
});
assertCharacter(field, '\u2661');
});
@@ -200,7 +200,7 @@ suite('Checkbox Fields', function() {
});
test('Remove Custom Character', function() {
const field = new Blockly.FieldCheckbox(true, null, {
- 'checkCharacter': '\u2661'
+ 'checkCharacter': '\u2661',
});
assertCharacter(field, '\u2661');
field.setCheckCharacter(null);
diff --git a/tests/mocha/field_colour_test.js b/tests/mocha/field_colour_test.js
index d51ca49bc..97fd27c96 100644
--- a/tests/mocha/field_colour_test.js
+++ b/tests/mocha/field_colour_test.js
@@ -210,7 +210,7 @@ suite('Colour Fields', function() {
test('JS Constructor', function() {
const field = new Blockly.FieldColour('#aaaaaa', null, {
colourOptions: ['#aaaaaa'],
- colourTitles: ['grey']
+ colourTitles: ['grey'],
});
assertColoursAndTitles(field, ['#aaaaaa'], ['grey']);
});
@@ -218,7 +218,7 @@ suite('Colour Fields', function() {
const field = Blockly.FieldColour.fromJson({
colour: '#aaaaaa',
colourOptions: ['#aaaaaa'],
- colourTitles: ['grey']
+ colourTitles: ['grey'],
});
assertColoursAndTitles(field, ['#aaaaaa'], ['grey']);
});
@@ -264,14 +264,14 @@ suite('Colour Fields', function() {
});
test('JS Constructor', function() {
const field = new Blockly.FieldColour('#ffffff', null, {
- columns: 3
+ columns: 3,
});
assertColumns(field, 3);
});
test('JSON Definition', function() {
const field = Blockly.FieldColour.fromJson({
'colour': '#ffffff',
- 'columns': 3
+ 'columns': 3,
});
assertColumns(field, 3);
});
diff --git a/tests/mocha/field_dropdown_test.js b/tests/mocha/field_dropdown_test.js
index 90fd03ff4..11b517b6e 100644
--- a/tests/mocha/field_dropdown_test.js
+++ b/tests/mocha/field_dropdown_test.js
@@ -47,9 +47,9 @@ suite('Dropdown Fields', function() {
args: [[['a', 'A'], ['b', 'B'], ['c', 'C']]]},
{title: 'Image Dropdown', value: 'A', expectedValue: 'A', expectedText: 'a',
args: [[
- [{ src:'scrA', alt:'a' }, 'A'],
- [{ src:'scrB', alt:'b' }, 'B'],
- [{ src:'scrC', alt:'c' }, 'C']]]},
+ [{src: 'scrA', alt: 'a'}, 'A'],
+ [{src: 'scrB', alt: 'b'}, 'B'],
+ [{src: 'scrC', alt: 'c'}, 'C']]]},
{title: 'Dynamic Text Dropdown', value: 'A', expectedValue: 'A', expectedText: 'a',
args: [() => {
return [['a', 'A'], ['b', 'B'], ['c', 'C']];
@@ -57,9 +57,9 @@ suite('Dropdown Fields', function() {
{title: 'Dynamic Image Dropdown', value: 'A', expectedValue: 'A', expectedText: 'a',
args: [() => {
return [
- [{ src:'scrA', alt:'a' }, 'A'],
- [{ src:'scrB', alt:'b' }, 'B'],
- [{ src:'scrC', alt:'c' }, 'C']];
+ [{src: 'scrA', alt: 'a'}, 'A'],
+ [{src: 'scrB', alt: 'b'}, 'B'],
+ [{src: 'scrC', alt: 'c'}, 'C']];
}]},
];
const addJson = function(testCase) {
diff --git a/tests/mocha/field_image_test.js b/tests/mocha/field_image_test.js
index 69b03c038..fcc68fd67 100644
--- a/tests/mocha/field_image_test.js
+++ b/tests/mocha/field_image_test.js
@@ -116,7 +116,7 @@ suite('Image Fields', function() {
src: 'src',
width: 10,
height: 10,
- alt: 'alt'
+ alt: 'alt',
});
chai.assert.equal(field.altText_, 'alt');
});
@@ -139,25 +139,25 @@ suite('Image Fields', function() {
});
test('JS Configuration - Simple', function() {
const field = new Blockly.FieldImage('src', 10, 10, null, null, null, {
- alt: 'alt'
+ alt: 'alt',
});
chai.assert.equal(field.altText_, 'alt');
});
test('JS Configuration - Ignore', function() {
const field = new Blockly.FieldImage('src', 10, 10, 'alt', null, null, {
- alt: 'configAlt'
+ alt: 'configAlt',
});
chai.assert.equal(field.altText_, 'configAlt');
});
test('JS Configuration - Ignore - \'\'', function() {
const field = new Blockly.FieldImage('src', 10, 10, '', null, null, {
- alt: 'configAlt'
+ alt: 'configAlt',
});
chai.assert.equal(field.altText_, 'configAlt');
});
test('JS Configuration - Ignore - Config \'\'', function() {
const field = new Blockly.FieldImage('src', 10, 10, 'alt', null, null, {
- alt: ''
+ alt: '',
});
chai.assert.equal(field.altText_, '');
});
@@ -172,25 +172,25 @@ suite('Image Fields', function() {
src: 'src',
width: 10,
height: 10,
- flipRtl: true
+ flipRtl: true,
});
chai.assert.isTrue(field.getFlipRtl());
});
test('JS Configuration - Simple', function() {
const field = new Blockly.FieldImage('src', 10, 10, null, null, null, {
- flipRtl: true
+ flipRtl: true,
});
chai.assert.isTrue(field.getFlipRtl());
});
test('JS Configuration - Ignore - True', function() {
const field = new Blockly.FieldImage('src', 10, 10, null, null, true, {
- flipRtl: false
+ flipRtl: false,
});
chai.assert.isFalse(field.getFlipRtl());
});
test('JS Configuration - Ignore - False', function() {
const field = new Blockly.FieldImage('src', 10, 10, null, null, false, {
- flipRtl: true
+ flipRtl: true,
});
chai.assert.isTrue(field.getFlipRtl());
});
diff --git a/tests/mocha/field_label_serializable_test.js b/tests/mocha/field_label_serializable_test.js
index dd0c164fa..212173b2a 100644
--- a/tests/mocha/field_label_serializable_test.js
+++ b/tests/mocha/field_label_serializable_test.js
@@ -105,7 +105,7 @@ suite('Label Serializable Fields', function() {
labelField.fieldGroup_ = Blockly.utils.dom.createSvgElement(
Blockly.utils.Svg.G, {}, null);
labelField.constants_ = {
- FIELD_TEXT_BASELINE_Y: 13
+ FIELD_TEXT_BASELINE_Y: 13,
};
labelField.initView();
chai.assert.isTrue(Blockly.utils.dom.hasClass(
@@ -115,7 +115,7 @@ suite('Label Serializable Fields', function() {
labelField.fieldGroup_ = Blockly.utils.dom.createSvgElement(
Blockly.utils.Svg.G, {}, null);
labelField.constants_ = {
- FIELD_TEXT_BASELINE_Y: 13
+ FIELD_TEXT_BASELINE_Y: 13,
};
labelField.initView();
chai.assert.isFalse(Blockly.utils.dom.hasClass(
@@ -127,32 +127,32 @@ suite('Label Serializable Fields', function() {
});
test('JSON Definition', function() {
const field = Blockly.FieldLabelSerializable.fromJson({
- class: 'testClass'
+ class: 'testClass',
});
assertHasClass(field, 'testClass');
});
test('JS Configuration - Simple', function() {
const field = new Blockly.FieldLabelSerializable('text', null, {
- class: 'testClass'
+ class: 'testClass',
});
assertHasClass(field, 'testClass');
});
test('JS Configuration - Ignore', function() {
const field = new Blockly.FieldLabelSerializable('text', 'paramClass', {
- class: 'configClass'
+ class: 'configClass',
});
assertDoesNotHaveClass(field, 'paramClass');
assertHasClass(field, 'configClass');
});
test('JS Configuration - Ignore - \'\'', function() {
const field = new Blockly.FieldLabelSerializable('text', '', {
- class: 'configClass'
+ class: 'configClass',
});
assertHasClass(field, 'configClass');
});
test('JS Configuration - Ignore - Config \'\'', function() {
const field = new Blockly.FieldLabelSerializable('text', 'paramClass', {
- class: ''
+ class: '',
});
assertDoesNotHaveClass(field, 'paramClass');
});
@@ -162,7 +162,7 @@ suite('Label Serializable Fields', function() {
field.fieldGroup_ = Blockly.utils.dom.createSvgElement(
Blockly.utils.Svg.G, {}, null);
field.constants_ = {
- FIELD_TEXT_BASELINE_Y: 13
+ FIELD_TEXT_BASELINE_Y: 13,
};
field.initView();
field.setClass('testClass');
@@ -177,7 +177,7 @@ suite('Label Serializable Fields', function() {
});
test('Remove Class', function() {
const field = new Blockly.FieldLabelSerializable('text', null, {
- class: 'testClass'
+ class: 'testClass',
});
assertHasClass(field, 'testClass');
field.setClass(null);
diff --git a/tests/mocha/field_label_test.js b/tests/mocha/field_label_test.js
index 7005e8c5f..52fedef90 100644
--- a/tests/mocha/field_label_test.js
+++ b/tests/mocha/field_label_test.js
@@ -105,7 +105,7 @@ suite('Label Fields', function() {
labelField.fieldGroup_ = Blockly.utils.dom.createSvgElement(
Blockly.utils.Svg.G, {}, null);
labelField.constants_ = {
- FIELD_TEXT_BASELINE_Y: 13
+ FIELD_TEXT_BASELINE_Y: 13,
};
labelField.initView();
chai.assert.isTrue(Blockly.utils.dom.hasClass(
@@ -115,7 +115,7 @@ suite('Label Fields', function() {
labelField.fieldGroup_ = Blockly.utils.dom.createSvgElement(
Blockly.utils.Svg.G, {}, null);
labelField.constants_ = {
- FIELD_TEXT_BASELINE_Y: 13
+ FIELD_TEXT_BASELINE_Y: 13,
};
labelField.initView();
chai.assert.isFalse(Blockly.utils.dom.hasClass(
@@ -128,32 +128,32 @@ suite('Label Fields', function() {
});
test('JSON Definition', function() {
const field = Blockly.FieldLabel.fromJson({
- class: 'testClass'
+ class: 'testClass',
});
assertHasClass(field, 'testClass');
});
test('JS Configuration - Simple', function() {
const field = new Blockly.FieldLabel('text', null, {
- class: 'testClass'
+ class: 'testClass',
});
assertHasClass(field, 'testClass');
});
test('JS Configuration - Ignore', function() {
const field = new Blockly.FieldLabel('text', 'paramClass', {
- class: 'configClass'
+ class: 'configClass',
});
assertDoesNotHaveClass(field, 'paramClass');
assertHasClass(field, 'configClass');
});
test('JS Configuration - Ignore - \'\'', function() {
const field = new Blockly.FieldLabel('text', '', {
- class: 'configClass'
+ class: 'configClass',
});
assertHasClass(field, 'configClass');
});
test('JS Configuration - Ignore - Config \'\'', function() {
const field = new Blockly.FieldLabel('text', 'paramClass', {
- class: ''
+ class: '',
});
assertDoesNotHaveClass(field, 'paramClass');
});
@@ -163,7 +163,7 @@ suite('Label Fields', function() {
field.fieldGroup_ = Blockly.utils.dom.createSvgElement(
Blockly.utils.Svg.G, {}, null);
field.constants_ = {
- FIELD_TEXT_BASELINE_Y: 13
+ FIELD_TEXT_BASELINE_Y: 13,
};
field.initView();
field.setClass('testClass');
@@ -178,7 +178,7 @@ suite('Label Fields', function() {
});
test('Remove Class', function() {
const field = new Blockly.FieldLabel('text', null, {
- class: 'testClass'
+ class: 'testClass',
});
assertHasClass(field, 'testClass');
field.setClass(null);
diff --git a/tests/mocha/field_number_test.js b/tests/mocha/field_number_test.js
index 0c6345147..379bb5b83 100644
--- a/tests/mocha/field_number_test.js
+++ b/tests/mocha/field_number_test.js
@@ -252,14 +252,14 @@ suite('Number Fields', function() {
test('JS Configuration - Simple', function() {
const field = new Blockly.FieldNumber(
undefined, undefined, undefined, undefined, undefined, {
- min: -10
+ min: -10,
});
assertNumberField(field, -10, Infinity, 0, 0);
});
test('JS Configuration - Ignore', function() {
const field = new Blockly.FieldNumber(
undefined, -1, undefined, undefined, undefined, {
- min: -10
+ min: -10,
});
assertNumberField(field, -10, Infinity, 0, 0);
});
@@ -288,14 +288,14 @@ suite('Number Fields', function() {
test('JS Configuration - Simple', function() {
const field = new Blockly.FieldNumber(
undefined, undefined, undefined, undefined, undefined, {
- max: 10
+ max: 10,
});
assertNumberField(field, -Infinity, 10, 0, 0);
});
test('JS Configuration - Ignore', function() {
const field = new Blockly.FieldNumber(
undefined, undefined, 1, undefined, undefined, {
- max: 10
+ max: 10,
});
assertNumberField(field, -Infinity, 10, 0, 0);
});
@@ -324,14 +324,14 @@ suite('Number Fields', function() {
test('JS Configuration - Simple', function() {
const field = new Blockly.FieldNumber(
undefined, undefined, undefined, undefined, undefined, {
- precision: 1
+ precision: 1,
});
assertNumberField(field, -Infinity, Infinity, 1, 0);
});
test('JS Configuration - Ignore', function() {
const field = new Blockly.FieldNumber(
undefined, undefined, undefined, .5, undefined, {
- precision: 1
+ precision: 1,
});
assertNumberField(field, -Infinity, Infinity, 1, 0);
});
diff --git a/tests/mocha/field_registry_test.js b/tests/mocha/field_registry_test.js
index ffe70b0c8..0e49b5620 100644
--- a/tests/mocha/field_registry_test.js
+++ b/tests/mocha/field_registry_test.js
@@ -60,7 +60,7 @@ suite('Field Registry', function() {
const json = {
type: 'field_custom_test',
- value: 'ok'
+ value: 'ok',
};
const field = Blockly.fieldRegistry.fromJson(json);
@@ -71,7 +71,7 @@ suite('Field Registry', function() {
test('Not Registered', function() {
const json = {
type: 'field_custom_test',
- value: 'ok'
+ value: 'ok',
};
const spy = sinon.stub(console, 'warn');
@@ -85,7 +85,7 @@ suite('Field Registry', function() {
const json = {
type: 'FIELD_CUSTOM_TEST',
- value: 'ok'
+ value: 'ok',
};
const field = Blockly.fieldRegistry.fromJson(json);
diff --git a/tests/mocha/field_test.js b/tests/mocha/field_test.js
index 2d730d64d..6ef1cbf24 100644
--- a/tests/mocha/field_test.js
+++ b/tests/mocha/field_test.js
@@ -138,7 +138,7 @@ suite('Abstract Fields', function() {
saveState() {
return {
default: super.saveState(),
- val: 'custom value'
+ val: 'custom value',
};
}
@@ -606,13 +606,13 @@ suite('Abstract Fields', function() {
return 'dynamic tooltip text';
};
const field = new Blockly.Field('value', null, {
- tooltip: returnTooltip
+ tooltip: returnTooltip,
});
chai.assert.equal(field.tooltip_, returnTooltip);
});
test('JSON Definition', function() {
const field = CustomField.fromJson({
- tooltip: "test tooltip"
+ tooltip: "test tooltip",
});
chai.assert.equal(field.tooltip_, 'test tooltip');
});
@@ -629,7 +629,7 @@ suite('Abstract Fields', function() {
});
test('JSON Definition', function() {
const field = CustomField.fromJson({
- tooltip: "%{BKY_TOOLTIP}"
+ tooltip: "%{BKY_TOOLTIP}",
});
chai.assert.equal(field.tooltip_, 'test tooltip');
});
@@ -708,7 +708,7 @@ suite('Abstract Fields', function() {
tooltipFunc: function() {
return this.getFieldValue('TOOLTIP');
- }
+ },
};
const block = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(
'' +
@@ -728,8 +728,8 @@ suite('Abstract Fields', function() {
.appendField(field, 'TOOLTIP');
},
element: {
- tooltip: 'tooltip'
- }
+ tooltip: 'tooltip',
+ },
};
const block = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(
'' +
diff --git a/tests/mocha/field_textinput_test.js b/tests/mocha/field_textinput_test.js
index 50909b903..d95e31204 100644
--- a/tests/mocha/field_textinput_test.js
+++ b/tests/mocha/field_textinput_test.js
@@ -155,21 +155,29 @@ suite('Text Input Fields', function() {
getScale: function() {
return 1;
},
- getRenderer: function() { return {
- getClassName: function() { return ''; }
- }; },
- getTheme: function() { return {
- getClassName: function() { return ''; }
- }; },
- markFocused: function() {}
+ getRenderer: function() {
+ return {
+ getClassName: function() {
+ return '';
+ },
+ };
+ },
+ getTheme: function() {
+ return {
+ getClassName: function() {
+ return '';
+ },
+ };
+ },
+ markFocused: function() {},
};
field.sourceBlock_ = {
- workspace: workspace
+ workspace: workspace,
};
field.constants_ = {
FIELD_TEXT_FONTSIZE: 11,
FIELD_TEXT_FONTWEIGHT: 'normal',
- FIELD_TEXT_FONTFAMILY: 'sans-serif'
+ FIELD_TEXT_FONTFAMILY: 'sans-serif',
};
field.clickTarget_ = document.createElement('div');
Blockly.common.setMainWorkspace(workspace);
@@ -195,14 +203,14 @@ suite('Text Input Fields', function() {
});
test('JS Constructor', function() {
const field = new Blockly.FieldTextInput('test', null, {
- spellcheck: false
+ spellcheck: false,
});
this.assertSpellcheck(field, false);
});
test('JSON Definition', function() {
const field = Blockly.FieldTextInput.fromJson({
text: 'test',
- spellcheck: false
+ spellcheck: false,
});
this.assertSpellcheck(field, false);
});
@@ -225,7 +233,7 @@ suite('Text Input Fields', function() {
setup(function() {
this.workspace = new Blockly.Workspace();
defineRowBlock();
-
+
this.assertValue = (value) => {
const block = this.workspace.newBlock('row_block');
const field = new Blockly.FieldTextInput(value);
diff --git a/tests/mocha/field_variable_test.js b/tests/mocha/field_variable_test.js
index 91f993542..4a93ccf41 100644
--- a/tests/mocha/field_variable_test.js
+++ b/tests/mocha/field_variable_test.js
@@ -254,7 +254,7 @@ suite('Variable Fields', function() {
const field = Blockly.FieldVariable.fromJson({
variable: 'test',
variableTypes: ['Type1'],
- defaultType: 'Type1'
+ defaultType: 'Type1',
});
chai.assert.deepEqual(field.variableTypes, ['Type1']);
chai.assert.equal(field.defaultType_, 'Type1');
@@ -263,7 +263,7 @@ suite('Variable Fields', function() {
const field = new Blockly.FieldVariable(
'test', undefined, undefined, undefined, {
variableTypes: ['Type1'],
- defaultType: 'Type1'
+ defaultType: 'Type1',
});
chai.assert.deepEqual(field.variableTypes, ['Type1']);
chai.assert.equal(field.defaultType_, 'Type1');
@@ -272,7 +272,7 @@ suite('Variable Fields', function() {
const field = new Blockly.FieldVariable(
'test', undefined, ['Type2'], 'Type2', {
variableTypes: ['Type1'],
- defaultType: 'Type1'
+ defaultType: 'Type1',
});
chai.assert.deepEqual(field.variableTypes, ['Type1']);
chai.assert.equal(field.defaultType_, 'Type1');
@@ -362,8 +362,8 @@ suite('Variable Fields', function() {
{
"type": "field_variable",
"name": "VAR",
- "variable": "name1"
- }
+ "variable": "name1",
+ },
],
}]);
this.variableBlock = new Blockly.Block(this.workspace,
@@ -458,9 +458,9 @@ suite('Variable Fields', function() {
'type': 'variables_get',
'fields': {
'VAR': {
- 'id': 'id1'
- }
- }
+ 'id': 'id1',
+ },
+ },
},
this.workspace);
const variable = block.getField('VAR').getVariable();
@@ -475,8 +475,8 @@ suite('Variable Fields', function() {
'fields': {
'VAR': {
'name': 'test',
- }
- }
+ },
+ },
},
this.workspace);
const variable = block.getField('VAR').getVariable();
@@ -492,8 +492,8 @@ suite('Variable Fields', function() {
'VAR': {
'name': 'test',
'type': 'string',
- }
- }
+ },
+ },
},
this.workspace);
const variable = block.getField('VAR').getVariable();
diff --git a/tests/mocha/flyout_test.js b/tests/mocha/flyout_test.js
index 8357cb424..8f3e56693 100644
--- a/tests/mocha/flyout_test.js
+++ b/tests/mocha/flyout_test.js
@@ -20,14 +20,14 @@ suite('Flyout', function() {
{
"type": "field_input",
"name": "TEXT",
- "text": "default"
- }
- ]
+ "text": "default",
+ },
+ ],
}]);
this.toolboxXml = document.getElementById('toolbox-simple');
this.workspace = Blockly.inject('blocklyDiv',
{
- toolbox: this.toolboxXml
+ toolbox: this.toolboxXml,
});
});
@@ -66,7 +66,7 @@ suite('Flyout', function() {
const toolbox = document.getElementById('toolbox-categories');
this.workspace = Blockly.inject('blocklyDiv',
{
- toolbox: toolbox
+ toolbox: toolbox,
});
this.flyout = this.workspace.getToolbox().getFlyout();
this.targetMetricsManager = this.flyout.targetWorkspace.getMetricsManager();
@@ -308,7 +308,7 @@ suite('Flyout', function() {
sinon.stub(
this.flyout.workspace_.targetWorkspace,
'getToolboxCategoryCallback')
- .returns(function() { return val; });
+ .returns(function() {return val;});
this.flyout.show('someString');
checkFlyoutInfo(this.createFlyoutSpy);
};
@@ -406,7 +406,7 @@ suite('Flyout', function() {
{
'kind': 'block',
'type': 'text_print',
- }
+ },
];
this.flyout.show(json);
this.assertDisabled(false);
@@ -418,7 +418,7 @@ suite('Flyout', function() {
'kind': 'block',
'type': 'text_print',
'enabled': true,
- }
+ },
];
this.flyout.show(json);
this.assertDisabled(false);
@@ -430,7 +430,7 @@ suite('Flyout', function() {
'kind': 'block',
'type': 'text_print',
'enabled': false,
- }
+ },
];
this.flyout.show(json);
this.assertDisabled(true);
@@ -441,8 +441,8 @@ suite('Flyout', function() {
{
'kind': 'block',
'type': 'text_print',
- 'disabled': 'true'
- }
+ 'disabled': 'true',
+ },
];
this.flyout.show(json);
this.assertDisabled(true);
@@ -453,8 +453,8 @@ suite('Flyout', function() {
{
'kind': 'block',
'type': 'text_print',
- 'disabled': 'false'
- }
+ 'disabled': 'false',
+ },
];
this.flyout.show(json);
this.assertDisabled(false);
@@ -465,8 +465,8 @@ suite('Flyout', function() {
{
'kind': 'block',
'type': 'text_print',
- 'disabled': 'disabled' // This is not respected by the JSON!
- }
+ 'disabled': 'disabled', // This is not respected by the JSON!
+ },
];
this.flyout.show(json);
this.assertDisabled(false);
@@ -477,8 +477,8 @@ suite('Flyout', function() {
{
'kind': 'block',
'type': 'text_print',
- 'disabled': true
- }
+ 'disabled': true,
+ },
];
this.flyout.show(json);
this.assertDisabled(true);
@@ -489,8 +489,8 @@ suite('Flyout', function() {
{
'kind': 'block',
'type': 'text_print',
- 'disabled': false
- }
+ 'disabled': false,
+ },
];
this.flyout.show(json);
this.assertDisabled(false);
@@ -501,8 +501,8 @@ suite('Flyout', function() {
{
'kind': 'block',
'type': 'text_print',
- 'disabled': 'random'
- }
+ 'disabled': 'random',
+ },
];
this.flyout.show(json);
this.assertDisabled(false);
@@ -513,8 +513,8 @@ suite('Flyout', function() {
{
'kind': 'block',
'type': 'text_print',
- 'disabled': ''
- }
+ 'disabled': '',
+ },
];
this.flyout.show(json);
this.assertDisabled(false);
@@ -535,10 +535,10 @@ suite('Flyout', function() {
'kind': 'BLOCK',
'type': 'math_number',
'fields': {
- 'NUM': 123
- }
- }
- ]
+ 'NUM': 123,
+ },
+ },
+ ],
});
this.flyout.show({
'contents': [
@@ -546,27 +546,27 @@ suite('Flyout', function() {
'kind': 'BLOCK',
'type': 'math_number',
'fields': {
- 'NUM': 321
- }
- }
- ]
+ 'NUM': 321,
+ },
+ },
+ ],
});
const block = this.flyout.workspace_.getAllBlocks()[0];
chai.assert.equal(block.getFieldValue('NUM'), 321);
});
test('Recycling enabled', function() {
- this.flyout.blockIsRecyclable_ = function() { return true; };
+ this.flyout.blockIsRecyclable_ = function() {return true;};
this.flyout.show({
'contents': [
{
'kind': 'BLOCK',
'type': 'math_number',
'fields': {
- 'NUM': 123
- }
- }
- ]
+ 'NUM': 123,
+ },
+ },
+ ],
});
this.flyout.show({
'contents': [
@@ -574,10 +574,10 @@ suite('Flyout', function() {
'kind': 'BLOCK',
'type': 'math_number',
'fields': {
- 'NUM': 321
- }
- }
- ]
+ 'NUM': 321,
+ },
+ },
+ ],
});
const block = this.flyout.workspace_.getAllBlocks()[0];
chai.assert.equal(block.getFieldValue('NUM'), 123);
diff --git a/tests/mocha/generator_test.js b/tests/mocha/generator_test.js
index 5947966b3..2231263d2 100644
--- a/tests/mocha/generator_test.js
+++ b/tests/mocha/generator_test.js
@@ -34,7 +34,7 @@ suite('Generator', function() {
});
test('One word', function() {
- chai.assert.equal(this.generator.prefixLines('Hello', '@'), '@Hello') ;
+ chai.assert.equal(this.generator.prefixLines('Hello', '@'), '@Hello');
});
test('One line', function() {
@@ -52,7 +52,7 @@ suite('Generator', function() {
"type": "stack_block",
"message0": "",
"previousStatement": null,
- "nextStatement": null
+ "nextStatement": null,
},
{
"type": "row_block",
@@ -60,11 +60,11 @@ suite('Generator', function() {
"args0": [
{
"type": "input_value",
- "name": "INPUT"
- }
+ "name": "INPUT",
+ },
],
"output": null,
- "nextStatement": null
+ "nextStatement": null,
}]);
const rowBlock = this.workspace.newBlock('row_block');
const stackBlock = this.workspace.newBlock('stack_block');
@@ -72,8 +72,8 @@ suite('Generator', function() {
this.blockToCodeTest = function(
generator, blockDisabled, opt_thisOnly,
expectedCode, opt_message) {
- generator.row_block = function(_){return 'row_block';};
- generator.stack_block = function(_){return 'stack_block';};
+ generator.row_block = function(_) {return 'row_block';};
+ generator.stack_block = function(_) {return 'stack_block';};
rowBlock.nextConnection.connect(stackBlock.previousConnection);
rowBlock.disabled = blockDisabled;
@@ -121,17 +121,17 @@ suite('Generator', function() {
"message1": "%1",
"args1": [{
"type": "input_statement",
- "name": "DO"
+ "name": "DO",
}],
"previousStatement": null,
- "nextStatement": null
+ "nextStatement": null,
}]);
const blockA = this.workspace.newBlock('test_loop_block');
const blockB = this.workspace.newBlock('test_loop_block');
const blockC = this.workspace.newBlock('test_loop_block');
this.loopTest = function(
generator, opt_thisOnly, expectedCode, opt_message) {
- generator.test_loop_block = function(block){
+ generator.test_loop_block = function(block) {
return '{' + generator.statementToCode(block, 'DO') + '}';
};
blockA.getInput('DO').connection.connect(blockB.previousConnection);
diff --git a/tests/mocha/gesture_test.js b/tests/mocha/gesture_test.js
index cb05a92c2..8ecaee0de 100644
--- a/tests/mocha/gesture_test.js
+++ b/tests/mocha/gesture_test.js
@@ -10,7 +10,7 @@ const {assertEventFired, assertEventNotFired, defineBasicBlockWithField, dispatc
suite('Gesture', function() {
- function testGestureIsFieldClick(block, isFieldClick, eventsFireStub){
+ function testGestureIsFieldClick(block, isFieldClick, eventsFireStub) {
const field = block.getField('NAME');
const eventTarget = field.getClickTarget_();
chai.assert.exists(eventTarget,
@@ -54,7 +54,7 @@ suite('Gesture', function() {
});
test('Constructor', function() {
- const e = { id: 'dummy_test_event'};
+ const e = {id: 'dummy_test_event'};
const gesture = new Blockly.Gesture(e, this.workspace);
chai.assert.equal(gesture.mostRecentEvent_, e);
chai.assert.equal(gesture.creatorWorkspace_, this.workspace);
diff --git a/tests/mocha/input_test.js b/tests/mocha/input_test.js
index 3bb68640c..3a7f1055b 100644
--- a/tests/mocha/input_test.js
+++ b/tests/mocha/input_test.js
@@ -15,7 +15,7 @@ suite('Inputs', function() {
Blockly.defineBlocksWithJsonArray([{
"type": "empty_block",
"message0": "",
- "args0": []
+ "args0": [],
}]);
this.workspace = Blockly.inject('blocklyDiv');
@@ -120,7 +120,7 @@ suite('Inputs', function() {
const field = new Blockly.FieldDropdown(
[
['prefix option1', 'OPTION1'],
- ['prefix option2', 'OPTION2']
+ ['prefix option2', 'OPTION2'],
]
);
@@ -131,7 +131,7 @@ suite('Inputs', function() {
const field = new Blockly.FieldDropdown(
[
['option1 suffix', 'OPTION1'],
- ['option2 suffix', 'OPTION2']
+ ['option2 suffix', 'OPTION2'],
]
);
@@ -142,7 +142,7 @@ suite('Inputs', function() {
const field = new Blockly.FieldDropdown(
[
['prefix option1 suffix', 'OPTION1'],
- ['prefix option2 suffix', 'OPTION2']
+ ['prefix option2 suffix', 'OPTION2'],
]
);
diff --git a/tests/mocha/insertion_marker_test.js b/tests/mocha/insertion_marker_test.js
index c94786bf9..318d25306 100644
--- a/tests/mocha/insertion_marker_test.js
+++ b/tests/mocha/insertion_marker_test.js
@@ -18,7 +18,7 @@ suite('InsertionMarkers', function() {
"type": "stack_block",
"message0": "",
"previousStatement": null,
- "nextStatement": null
+ "nextStatement": null,
},
{
"type": "row_block",
@@ -26,10 +26,10 @@ suite('InsertionMarkers', function() {
"args0": [
{
"type": "input_value",
- "name": "INPUT"
- }
+ "name": "INPUT",
+ },
],
- "output": null
+ "output": null,
},
{
"type": "statement_block",
@@ -37,11 +37,11 @@ suite('InsertionMarkers', function() {
"args0": [
{
"type": "input_statement",
- "name": "STATEMENT"
- }
+ "name": "STATEMENT",
+ },
],
"previousStatement": null,
- "nextStatement": null
+ "nextStatement": null,
}]);
});
teardown(function() {
diff --git a/tests/mocha/jso_deserialization_test.js b/tests/mocha/jso_deserialization_test.js
index 1a2887a46..3a0d51f8e 100644
--- a/tests/mocha/jso_deserialization_test.js
+++ b/tests/mocha/jso_deserialization_test.js
@@ -29,10 +29,10 @@ suite('JSO Deserialization', function() {
'type': 'controls_if',
'id': 'testId',
'x': 42,
- 'y': 42
+ 'y': 42,
},
- ]
- }
+ ],
+ },
};
Blockly.serialization.workspaces.load(state, this.workspace);
assertEventFired(
@@ -50,10 +50,10 @@ suite('JSO Deserialization', function() {
'type': 'controls_if',
'id': 'testId',
'x': 42,
- 'y': 42
+ 'y': 42,
},
- ]
- }
+ ],
+ },
};
Blockly.Events.setGroup('my group');
Blockly.serialization.workspaces.load(state, this.workspace);
@@ -70,7 +70,7 @@ suite('JSO Deserialization', function() {
{
'name': 'test',
'id': 'testId',
- }
+ },
],
'blocks': {
'blocks': [
@@ -81,17 +81,17 @@ suite('JSO Deserialization', function() {
'y': 42,
'fields': {
'VAR': {
- 'id': 'testId'
- }
- }
+ 'id': 'testId',
+ },
+ },
},
- ]
- }
+ ],
+ },
};
Blockly.serialization.workspaces.load(state, this.workspace);
const calls = this.eventsFireStub.getCalls();
const group = calls[0].args[0].group;
- chai.assert.isTrue(calls.every(call => call.args[0].group == group));
+ chai.assert.isTrue(calls.every((call) => call.args[0].group == group));
});
});
@@ -102,8 +102,8 @@ suite('JSO Deserialization', function() {
{
'name': 'test',
'id': 'testId',
- }
- ]
+ },
+ ],
};
Blockly.serialization.workspaces.load(state, this.workspace);
assertEventFired(
@@ -113,7 +113,7 @@ suite('JSO Deserialization', function() {
'varName': 'test',
'varId': 'testId',
'varType': '',
- 'recordUndo': false
+ 'recordUndo': false,
},
this.workspace.id);
});
@@ -124,8 +124,8 @@ suite('JSO Deserialization', function() {
{
'name': 'test',
'id': 'testId',
- }
- ]
+ },
+ ],
};
Blockly.serialization.workspaces.load(state, this.workspace, {recordUndo: true});
assertEventFired(
@@ -135,7 +135,7 @@ suite('JSO Deserialization', function() {
'varName': 'test',
'varId': 'testId',
'varType': '',
- 'recordUndo': true
+ 'recordUndo': true,
},
this.workspace.id);
});
@@ -146,8 +146,8 @@ suite('JSO Deserialization', function() {
{
'name': 'test',
'id': 'testId',
- }
- ]
+ },
+ ],
};
Blockly.Events.setGroup('my group');
Blockly.serialization.workspaces.load(state, this.workspace);
@@ -158,7 +158,7 @@ suite('JSO Deserialization', function() {
'varName': 'test',
'varId': 'testId',
'varType': '',
- 'group': 'my group'
+ 'group': 'my group',
},
this.workspace.id);
});
@@ -173,13 +173,13 @@ suite('JSO Deserialization', function() {
{
'name': 'test2',
'id': 'testId2',
- }
- ]
+ },
+ ],
};
Blockly.serialization.workspaces.load(state, this.workspace);
const calls = this.eventsFireStub.getCalls();
const group = calls[0].args[0].group;
- chai.assert.isTrue(calls.every(call => call.args[0].group == group));
+ chai.assert.isTrue(calls.every((call) => call.args[0].group == group));
});
test('Var with block', function() {
@@ -188,7 +188,7 @@ suite('JSO Deserialization', function() {
{
'name': 'test',
'id': 'testId',
- }
+ },
],
'blocks': {
'blocks': [
@@ -199,12 +199,12 @@ suite('JSO Deserialization', function() {
'y': 42,
'fields': {
'VAR': {
- 'id': 'testId'
- }
- }
+ 'id': 'testId',
+ },
+ },
},
- ]
- }
+ ],
+ },
};
Blockly.serialization.workspaces.load(state, this.workspace);
const calls = this.eventsFireStub.getCalls();
@@ -233,10 +233,10 @@ suite('JSO Deserialization', function() {
'type': 'controls_if',
'id': 'testId',
'x': 42,
- 'y': 42
+ 'y': 42,
},
- ]
- }
+ ],
+ },
};
Blockly.serialization.workspaces.load(state, this.workspace);
assertEventFired(
@@ -255,10 +255,10 @@ suite('JSO Deserialization', function() {
'type': 'controls_if',
'id': 'testId',
'x': 42,
- 'y': 42
+ 'y': 42,
},
- ]
- }
+ ],
+ },
};
Blockly.serialization.workspaces.load(state, this.workspace, {'recordUndo': true});
assertEventFired(
@@ -277,10 +277,10 @@ suite('JSO Deserialization', function() {
'type': 'controls_if',
'id': 'testId',
'x': 42,
- 'y': 42
+ 'y': 42,
},
- ]
- }
+ ],
+ },
};
Blockly.Events.setGroup('my group');
Blockly.serialization.workspaces.load(state, this.workspace);
@@ -300,21 +300,21 @@ suite('JSO Deserialization', function() {
'type': 'controls_if',
'id': 'testId',
'x': 42,
- 'y': 42
+ 'y': 42,
},
{
'type': 'controls_if',
'id': 'testId',
'x': 84,
- 'y': 84
+ 'y': 84,
},
- ]
- }
+ ],
+ },
};
Blockly.serialization.workspaces.load(state, this.workspace);
const calls = this.eventsFireStub.getCalls();
const group = calls[0].args[0].group;
- chai.assert.isTrue(calls.every(call => call.args[0].group == group));
+ chai.assert.isTrue(calls.every((call) => call.args[0].group == group));
});
test('With children', function() {
@@ -330,19 +330,19 @@ suite('JSO Deserialization', function() {
'DO0': {
'block': {
'type': 'controls_if',
- 'id': 'id2'
- }
- }
+ 'id': 'id2',
+ },
+ },
},
'next': {
'block': {
'type': 'controls_if',
- 'id': 'id3'
- }
- }
+ 'id': 'id3',
+ },
+ },
},
- ]
- }
+ ],
+ },
};
Blockly.serialization.workspaces.load(state, this.workspace);
assertEventFired(
@@ -360,7 +360,7 @@ suite('JSO Deserialization', function() {
'type': 'controls_if',
'id': 'testId',
'x': 42,
- 'y': 42
+ 'y': 42,
};
Blockly.serialization.blocks.append(state, this.workspace);
assertEventFired(
@@ -376,7 +376,7 @@ suite('JSO Deserialization', function() {
'type': 'controls_if',
'id': 'testId',
'x': 42,
- 'y': 42
+ 'y': 42,
};
Blockly.serialization.blocks.append(
state, this.workspace, {'recordUndo': true});
@@ -393,7 +393,7 @@ suite('JSO Deserialization', function() {
'type': 'controls_if',
'id': 'testId',
'x': 42,
- 'y': 42
+ 'y': 42,
};
Blockly.Events.setGroup('my group');
Blockly.serialization.blocks.append(state, this.workspace);
@@ -424,9 +424,9 @@ suite('JSO Deserialization', function() {
'blocks': [
{
'type': 'not_a_real_block',
- }
- ]
- }
+ },
+ ],
+ },
};
this.assertThrows(state, TypeError);
});
@@ -437,9 +437,9 @@ suite('JSO Deserialization', function() {
'blocks': [
{
'type': 'MATH_NUMBER',
- }
- ]
- }
+ },
+ ],
+ },
};
this.assertThrows(state, TypeError);
});
@@ -455,13 +455,13 @@ suite('JSO Deserialization', function() {
'inputs': {
'not_an_input': {
'block': {
- 'type': 'logic_boolean'
- }
- }
- }
- }
- ]
- }
+ 'type': 'logic_boolean',
+ },
+ },
+ },
+ },
+ ],
+ },
};
this.assertThrows(
state, Blockly.serialization.exceptions.MissingConnection);
@@ -476,13 +476,13 @@ suite('JSO Deserialization', function() {
'inputs': {
'a': {
'block': {
- 'type': 'logic_boolean'
- }
- }
- }
- }
- ]
- }
+ 'type': 'logic_boolean',
+ },
+ },
+ },
+ },
+ ],
+ },
};
this.assertThrows(
state, Blockly.serialization.exceptions.MissingConnection);
@@ -497,11 +497,11 @@ suite('JSO Deserialization', function() {
'next': {
'block': {
'type': 'text_print',
- }
- }
- }
- ]
- }
+ },
+ },
+ },
+ ],
+ },
};
this.assertThrows(
state, Blockly.serialization.exceptions.MissingConnection);
@@ -516,11 +516,11 @@ suite('JSO Deserialization', function() {
'next': {
'block': {
'type': 'logic_compare',
- }
- }
- }
- ]
- }
+ },
+ },
+ },
+ ],
+ },
};
this.assertThrows(
state, Blockly.serialization.exceptions.MissingConnection);
@@ -535,13 +535,13 @@ suite('JSO Deserialization', function() {
'inputs': {
'A': {
'block': {
- 'type': 'text_print'
- }
- }
- }
- }
- ]
- }
+ 'type': 'text_print',
+ },
+ },
+ },
+ },
+ ],
+ },
};
this.assertThrows(
state, Blockly.serialization.exceptions.MissingConnection);
@@ -558,13 +558,13 @@ suite('JSO Deserialization', function() {
'inputs': {
'A': {
'block': {
- 'type': 'math_number'
- }
- }
- }
- }
- ]
- }
+ 'type': 'math_number',
+ },
+ },
+ },
+ },
+ ],
+ },
};
this.assertThrows(
state, Blockly.serialization.exceptions.BadConnectionCheck);
@@ -586,15 +586,15 @@ suite('JSO Deserialization', function() {
'A': {
'block': {
'type': 'logic_boolean',
- }
- }
- }
- }
- }
- }
- }
- ]
- }
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ ],
+ },
};
this.assertThrows(
state, Blockly.serialization.exceptions.RealChildOfShadow);
@@ -612,13 +612,13 @@ suite('JSO Deserialization', function() {
'next': {
'block': {
'type': 'text_print',
- }
- }
- }
- }
- }
- ]
- }
+ },
+ },
+ },
+ },
+ },
+ ],
+ },
};
this.assertThrows(
state, Blockly.serialization.exceptions.RealChildOfShadow);
@@ -678,7 +678,7 @@ suite('JSO Deserialization', function() {
'first-clear',
'first-load',
'second-load',
- 'third-load'
+ 'third-load',
]);
});
@@ -697,7 +697,7 @@ suite('JSO Deserialization', function() {
domToMutation: function(element) {
this.someProperty = element.getAttribute('value');
- }
+ },
};
const block = Blockly.serialization.blocks.append(
diff --git a/tests/mocha/jso_serialization_test.js b/tests/mocha/jso_serialization_test.js
index 2ce1b8a95..02d97e34e 100644
--- a/tests/mocha/jso_serialization_test.js
+++ b/tests/mocha/jso_serialization_test.js
@@ -237,7 +237,7 @@ suite('JSO Serialization', function() {
'pinned': false,
'height': 80,
'width': 160,
- }
+ },
},
);
});
@@ -256,7 +256,7 @@ suite('JSO Serialization', function() {
'pinned': true,
'height': 80,
'width': 160,
- }
+ },
},
);
});
@@ -276,7 +276,7 @@ suite('JSO Serialization', function() {
'pinned': false,
'height': 40,
'width': 320,
- }
+ },
},
);
});
@@ -391,14 +391,14 @@ suite('JSO Serialization', function() {
const block = this.createBlockWithChild(blockType, inputName);
const jso = Blockly.serialization.blocks.save(block);
this.assertInput(
- jso, inputName, {'block': { 'type': blockType, 'id': 'id2'}});
+ jso, inputName, {'block': {'type': blockType, 'id': 'id2'}});
};
this.assertShadow = function(blockType, inputName) {
const block = this.createBlockWithShadow(blockType, inputName);
const jso = Blockly.serialization.blocks.save(block);
this.assertInput(
- jso, inputName, {'shadow': { 'type': blockType, 'id': 'test'}});
+ jso, inputName, {'shadow': {'type': blockType, 'id': 'test'}});
};
this.assertOverwrittenShadow = function(blockType, inputName) {
@@ -411,12 +411,12 @@ suite('JSO Serialization', function() {
{
'block': {
'type': blockType,
- 'id': 'id2'
+ 'id': 'id2',
},
'shadow': {
'type': blockType,
- 'id': 'test'
- }
+ 'id': 'test',
+ },
});
};
@@ -448,7 +448,7 @@ suite('JSO Serialization', function() {
const block = this.workspace.newBlock('text_print');
block.getInput('TEXT').connection.setShadowState({
'type': 'text',
- 'id': 'id'
+ 'id': 'id',
});
block.getInputTargetBlock('TEXT').setFieldValue('new value', 'TEXT');
const jso = Blockly.serialization.blocks.save(block);
@@ -460,9 +460,9 @@ suite('JSO Serialization', function() {
'type': 'text',
'id': 'id',
'fields': {
- 'TEXT': 'new value'
- }
- }
+ 'TEXT': 'new value',
+ },
+ },
});
});
@@ -470,7 +470,7 @@ suite('JSO Serialization', function() {
const block = this.workspace.newBlock('text_print');
block.getInput('TEXT').connection.setShadowState({
'type': 'text',
- 'id': 'id'
+ 'id': 'id',
});
block.getInputTargetBlock('TEXT').setFieldValue('new value', 'TEXT');
const childBlock = this.workspace.newBlock('text');
@@ -485,15 +485,15 @@ suite('JSO Serialization', function() {
'type': 'text',
'id': 'id',
'fields': {
- 'TEXT': 'new value'
- }
+ 'TEXT': 'new value',
+ },
},
'block': {
'type': 'text',
'id': 'id3',
'fields': {
- 'TEXT': ''
- }
+ 'TEXT': '',
+ },
},
});
});
@@ -562,10 +562,10 @@ suite('JSO Serialization', function() {
'next': {
'block': {
'type': 'stack_block',
- 'id': 'id4'
- }
- }
- }
+ 'id': 'id4',
+ },
+ },
+ },
}
);
});
@@ -620,14 +620,14 @@ suite('JSO Serialization', function() {
const jso =
Blockly.serialization.blocks.save(block);
chai.assert.deepInclude(
- jso['next'], {'block': { 'type': 'stack_block', 'id': 'id2'}});
+ jso['next'], {'block': {'type': 'stack_block', 'id': 'id2'}});
});
test('Shadow', function() {
const block = this.createNextWithShadow();
const jso = Blockly.serialization.blocks.save(block);
chai.assert.deepInclude(
- jso['next'], {'shadow': { 'type': 'stack_block', 'id': 'test'}});
+ jso['next'], {'shadow': {'type': 'stack_block', 'id': 'test'}});
});
test('Overwritten shadow', function() {
@@ -638,12 +638,12 @@ suite('JSO Serialization', function() {
{
'block': {
'type': 'stack_block',
- 'id': 'id2'
+ 'id': 'id2',
},
'shadow': {
'type': 'stack_block',
- 'id': 'test'
- }
+ 'id': 'test',
+ },
});
});
@@ -665,11 +665,11 @@ suite('JSO Serialization', function() {
'NAME': {
'block': {
'type': 'stack_block',
- 'id': 'id4'
- }
- }
- }
- }
+ 'id': 'id4',
+ },
+ },
+ },
+ },
}
);
});
diff --git a/tests/mocha/json_test.js b/tests/mocha/json_test.js
index 319e87af7..0a0b032b2 100644
--- a/tests/mocha/json_test.js
+++ b/tests/mocha/json_test.js
@@ -26,7 +26,7 @@ suite('JSON Block Definitions', function() {
let block;
assertNoWarnings(() => {
Blockly.defineBlocksWithJsonArray([{
- "type": BLOCK_TYPE
+ "type": BLOCK_TYPE,
}]);
block = new Blockly.Block(this.workspace_, BLOCK_TYPE);
});
@@ -69,12 +69,12 @@ suite('JSON Block Definitions', function() {
Blockly.defineBlocksWithJsonArray([
{
"type": BLOCK_TYPE1,
- "message0": 'before'
+ "message0": 'before',
},
null,
{
"type": BLOCK_TYPE2,
- "message0": 'after'
+ "message0": 'after',
}]);
}, /is null/);
chai.assert.isNotNull(Blockly.Blocks[BLOCK_TYPE1],
@@ -95,12 +95,12 @@ suite('JSON Block Definitions', function() {
Blockly.defineBlocksWithJsonArray([
{
"type": BLOCK_TYPE1,
- "message0": 'before'
+ "message0": 'before',
},
undefined,
{
"type": BLOCK_TYPE2,
- "message0": 'after'
+ "message0": 'after',
}]);
}, /is undefined/);
chai.assert.isNotNull(Blockly.Blocks[BLOCK_TYPE1],
@@ -115,7 +115,7 @@ suite('JSON Block Definitions', function() {
const MESSAGE0 = 'message0';
Blockly.defineBlocksWithJsonArray([{
"type": BLOCK_TYPE,
- "message0": MESSAGE0
+ "message0": MESSAGE0,
}]);
const block = new Blockly.Block(this.workspace_, BLOCK_TYPE);
@@ -134,7 +134,7 @@ suite('JSON Block Definitions', function() {
Blockly.defineBlocksWithJsonArray([{
"type": BLOCK_TYPE,
"message0": MESSAGE0,
- "message1": MESSAGE1
+ "message1": MESSAGE1,
}]);
const block = new Blockly.Block(this.workspace_, BLOCK_TYPE);
@@ -160,7 +160,7 @@ suite('JSON Block Definitions', function() {
Blockly.Msg['MESSAGE'] = MESSAGE;
Blockly.defineBlocksWithJsonArray([{
"type": BLOCK_TYPE,
- "message0": MESSAGE0
+ "message0": MESSAGE0,
}]);
const block = new Blockly.Block(this.workspace_, BLOCK_TYPE);
@@ -187,10 +187,10 @@ suite('JSON Block Definitions', function() {
"name": FIELD_NAME,
"options": [
[LABEL0, VALUE0],
- [LABEL1, VALUE1]
- ]
- }
- ]
+ [LABEL1, VALUE1],
+ ],
+ },
+ ],
}]);
const block = new Blockly.Block(this.workspace_, BLOCK_TYPE);
@@ -219,20 +219,20 @@ suite('JSON Block Definitions', function() {
'width': 12,
'height': 34,
'src': 'http://image0.src',
- 'alt': 'IMAGE0 alt text'
+ 'alt': 'IMAGE0 alt text',
};
const VALUE0 = 'VALUE0';
const IMAGE1 = {
'width': 56,
'height': 78,
'src': 'http://image1.src',
- 'alt': '%{BKY_ALT_TEXT}'
+ 'alt': '%{BKY_ALT_TEXT}',
};
const VALUE1 = 'VALUE1';
const IMAGE2 = {
'width': 90,
'height': 123,
- 'src': 'http://image2.src'
+ 'src': 'http://image2.src',
};
const VALUE2 = 'VALUE2';
@@ -246,10 +246,10 @@ suite('JSON Block Definitions', function() {
"options": [
[IMAGE0, VALUE0],
[IMAGE1, VALUE1],
- [IMAGE2, VALUE2]
- ]
- }
- ]
+ [IMAGE2, VALUE2],
+ ],
+ },
+ ],
}]);
const block = new Blockly.Block(this.workspace_, BLOCK_TYPE);
diff --git a/tests/mocha/keydown_test.js b/tests/mocha/keydown_test.js
index 5b17bc573..9236e3784 100644
--- a/tests/mocha/keydown_test.js
+++ b/tests/mocha/keydown_test.js
@@ -74,7 +74,7 @@ suite('Key Down', function() {
});
const testCases = [
['Delete', createKeyDownEvent(Blockly.utils.KeyCodes.DELETE)],
- ['Backspace', createKeyDownEvent(Blockly.utils.KeyCodes.BACKSPACE)]
+ ['Backspace', createKeyDownEvent(Blockly.utils.KeyCodes.BACKSPACE)],
];
// Delete a block.
suite('Simple', function() {
@@ -108,7 +108,7 @@ suite('Key Down', function() {
const testCases = [
['Control C', createKeyDownEvent(Blockly.utils.KeyCodes.C, [Blockly.utils.KeyCodes.CTRL])],
['Meta C', createKeyDownEvent(Blockly.utils.KeyCodes.C, [Blockly.utils.KeyCodes.META])],
- ['Alt C', createKeyDownEvent(Blockly.utils.KeyCodes.C, [Blockly.utils.KeyCodes.ALT])]
+ ['Alt C', createKeyDownEvent(Blockly.utils.KeyCodes.C, [Blockly.utils.KeyCodes.ALT])],
];
// Copy a block.
suite('Simple', function() {
@@ -180,7 +180,7 @@ suite('Key Down', function() {
const testCases = [
['Control Z', createKeyDownEvent(Blockly.utils.KeyCodes.Z, [Blockly.utils.KeyCodes.CTRL])],
['Meta Z', createKeyDownEvent(Blockly.utils.KeyCodes.Z, [Blockly.utils.KeyCodes.META])],
- ['Alt Z', createKeyDownEvent(Blockly.utils.KeyCodes.Z, [Blockly.utils.KeyCodes.ALT])]
+ ['Alt Z', createKeyDownEvent(Blockly.utils.KeyCodes.Z, [Blockly.utils.KeyCodes.ALT])],
];
// Undo.
suite('Simple', function() {
@@ -227,7 +227,7 @@ suite('Key Down', function() {
const testCases = [
['Control Shift Z', createKeyDownEvent(Blockly.utils.KeyCodes.Z, [Blockly.utils.KeyCodes.CTRL, Blockly.utils.KeyCodes.SHIFT])],
['Meta Shift Z', createKeyDownEvent(Blockly.utils.KeyCodes.Z, [Blockly.utils.KeyCodes.META, Blockly.utils.KeyCodes.SHIFT])],
- ['Alt Shift Z', createKeyDownEvent(Blockly.utils.KeyCodes.Z, [Blockly.utils.KeyCodes.ALT, Blockly.utils.KeyCodes.SHIFT])]
+ ['Alt Shift Z', createKeyDownEvent(Blockly.utils.KeyCodes.Z, [Blockly.utils.KeyCodes.ALT, Blockly.utils.KeyCodes.SHIFT])],
];
// Undo.
suite('Simple', function() {
diff --git a/tests/mocha/metrics_test.js b/tests/mocha/metrics_test.js
index e7efe131d..df3c7bd7e 100644
--- a/tests/mocha/metrics_test.js
+++ b/tests/mocha/metrics_test.js
@@ -31,8 +31,8 @@ suite('Metrics', function() {
scale: scale,
scrollX: SCROLL_X,
scrollY: SCROLL_Y,
- isMovableHorizontally: function() { return true; },
- isMovableVertically: function() { return true; }
+ isMovableHorizontally: function() {return true;},
+ isMovableVertically: function() {return true;},
};
}
diff --git a/tests/mocha/names_test.js b/tests/mocha/names_test.js
index 799f46ced..0c266cc05 100644
--- a/tests/mocha/names_test.js
+++ b/tests/mocha/names_test.js
@@ -60,5 +60,4 @@ suite('Names', function() {
chai.assert.isFalse(Blockly.Names.equals('Foo.bar', 'Foo_bar'), 'Name equals #2.');
chai.assert.isTrue(Blockly.Names.equals('Foo.bar', 'FOO.BAR'), 'Name equals #3.');
});
-
});
diff --git a/tests/mocha/procedures_test.js b/tests/mocha/procedures_test.js
index dc886c6f7..ae95d796a 100644
--- a/tests/mocha/procedures_test.js
+++ b/tests/mocha/procedures_test.js
@@ -379,7 +379,7 @@ suite('Procedures', function() {
getProcedureDef: function() {
return [this.name, [], false];
},
- name: 'test'
+ name: 'test',
};
Blockly.Blocks['nested_proc'] = {
@@ -737,7 +737,7 @@ suite('Procedures', function() {
this.barDef = this.workspaceSvg.getBlockById('bar-def');
this.barCalls = [
this.workspaceSvg.getBlockById('bar-c1'),
- this.workspaceSvg.getBlockById('bar-c2')
+ this.workspaceSvg.getBlockById('bar-c2'),
];
});
@@ -832,7 +832,7 @@ suite('Procedures', function() {
function setStatementValue(mainWorkspace, defBlock, value) {
const mutatorWorkspace = new Blockly.Workspace(
new Blockly.Options({
- parentWorkspace: mainWorkspace
+ parentWorkspace: mainWorkspace,
}));
defBlock.decompose(mutatorWorkspace);
const containerBlock = mutatorWorkspace.getTopBlocks()[0];
@@ -874,7 +874,7 @@ suite('Procedures', function() {
function createMutator(argArray) {
this.mutatorWorkspace = new Blockly.Workspace(
new Blockly.Options({
- parentWorkspace: this.workspace
+ parentWorkspace: this.workspace,
}));
this.containerBlock = this.defBlock.decompose(this.mutatorWorkspace);
this.connection = this.containerBlock.getInput('STACK').connection;
@@ -959,7 +959,7 @@ suite('Procedures', function() {
test('Has Statement Input', function() {
const mutatorWorkspace = new Blockly.Workspace(
new Blockly.Options({
- parentWorkspace: this.workspace
+ parentWorkspace: this.workspace,
}));
this.defBlock.decompose(mutatorWorkspace);
const statementInput = mutatorWorkspace.getTopBlocks()[0]
@@ -970,7 +970,7 @@ suite('Procedures', function() {
this.defBlock.hasStatements_ = true;
const mutatorWorkspace = new Blockly.Workspace(
new Blockly.Options({
- parentWorkspace: this.workspace
+ parentWorkspace: this.workspace,
}));
this.defBlock.decompose(mutatorWorkspace);
const statementValue = mutatorWorkspace.getTopBlocks()[0]
@@ -981,7 +981,7 @@ suite('Procedures', function() {
this.defBlock.hasStatements_ = false;
const mutatorWorkspace = new Blockly.Workspace(
new Blockly.Options({
- parentWorkspace: this.workspace
+ parentWorkspace: this.workspace,
}));
this.defBlock.decompose(mutatorWorkspace);
const statementValue = mutatorWorkspace.getTopBlocks()[0]
@@ -992,7 +992,7 @@ suite('Procedures', function() {
test('Has no Statement Input', function() {
const mutatorWorkspace = new Blockly.Workspace(
new Blockly.Options({
- parentWorkspace: this.workspace
+ parentWorkspace: this.workspace,
}));
this.defBlock.decompose(mutatorWorkspace);
const statementInput = mutatorWorkspace.getTopBlocks()[0]
@@ -1006,7 +1006,7 @@ suite('Procedures', function() {
this.defBlock.arguments_ = argumentsArray;
const mutatorWorkspace = new Blockly.Workspace(
new Blockly.Options({
- parentWorkspace: this.workspace
+ parentWorkspace: this.workspace,
}));
this.defBlock.decompose(mutatorWorkspace);
const argBlocks = mutatorWorkspace.getBlocksByType('procedures_mutatorarg');
diff --git a/tests/mocha/registry_test.js b/tests/mocha/registry_test.js
index db6bcf6eb..7865ee27d 100644
--- a/tests/mocha/registry_test.js
+++ b/tests/mocha/registry_test.js
@@ -144,7 +144,6 @@ suite('Registry', function() {
});
test('Name', function() {
-
assertWarnings(() => {
chai.assert.isNull(Blockly.registry.getObject('test', 'bad_name'));
}, /Unable to find/);
@@ -203,7 +202,7 @@ suite('Registry', function() {
Blockly.registry.getAllItems('test', true),
{
'test_name': {},
- 'casedNAME': {}
+ 'casedNAME': {},
});
});
@@ -213,7 +212,7 @@ suite('Registry', function() {
Blockly.registry.getAllItems('test', true),
{
'test_name': {},
- 'CASEDname': {}
+ 'CASEDname': {},
});
});
});
@@ -226,8 +225,8 @@ suite('Registry', function() {
};
this.options = {
'plugins': {
- 'test' : 'test_name'
- }
+ 'test': 'test_name',
+ },
};
Blockly.registry.register('test', 'test_name', TestClass);
Blockly.registry.register('test', 'default', this.defaultClass);
diff --git a/tests/mocha/serializer_test.js b/tests/mocha/serializer_test.js
index 52790eb20..43b77c51e 100644
--- a/tests/mocha/serializer_test.js
+++ b/tests/mocha/serializer_test.js
@@ -393,6 +393,7 @@ Serializer.Fields.MultilineInput.Indentation = new SerializerTestCase(
'line1 line2 line3' +
'' +
'');
+/* eslint-disable no-tabs */
Serializer.Fields.MultilineInput.Tabs = new SerializerTestCase(
'Tabs',
'' +
@@ -402,6 +403,7 @@ Serializer.Fields.MultilineInput.Tabs = new SerializerTestCase(
'' +
'' +
'');
+/* eslint-enable no-tabs */
Serializer.Fields.MultilineInput.Symbols = new SerializerTestCase('Symbols',
'' +
'' +
@@ -565,12 +567,14 @@ Serializer.Fields.TextInput.Simple = new SerializerTestCase('Simple',
'test' +
'' +
'');
+/* eslint-disable no-tabs */
Serializer.Fields.TextInput.Tabs = new SerializerTestCase('Tabs',
'' +
'' +
'line1 line2 line3' +
'' +
'');
+/* eslint-enable no-tabs */
Serializer.Fields.TextInput.Symbols = new SerializerTestCase('Symbols',
'' +
'' +
@@ -683,6 +687,7 @@ Serializer.Fields.Variable.Types = new SerializerTestCase('Types',
'test3' +
'' +
'');
+/* eslint-disable no-tabs */
Serializer.Fields.Variable.Tabs = new SerializerTestCase('Tabs',
'' +
'' +
@@ -692,6 +697,7 @@ Serializer.Fields.Variable.Tabs = new SerializerTestCase('Tabs',
'line1 line2 line3' +
'' +
'');
+/* eslint-enable no-tabs */
Serializer.Fields.Variable.Symbols = new SerializerTestCase('Symbols',
'' +
'' +
@@ -1599,7 +1605,7 @@ Serializer.Mutations.ListCreate.OneInput.testCases = [
];
Serializer.Mutations.ListCreate.testSuites = [
- Serializer.Mutations.ListCreate.OneInput
+ Serializer.Mutations.ListCreate.OneInput,
];
Serializer.Mutations.Procedure = new SerializerTestSuite('Procedure');
@@ -1819,4 +1825,4 @@ const runSerializerTestSuite = (serializer, deserializer, testSuite) => {
};
runSerializerTestSuite(null, null, Serializer);
-runSerializerTestSuite(state => state, state => state, Serializer);
+runSerializerTestSuite((state) => state, (state) => state, Serializer);
diff --git a/tests/mocha/shortcut_registry_test.js b/tests/mocha/shortcut_registry_test.js
index 23d0dd2bd..8039659e9 100644
--- a/tests/mocha/shortcut_registry_test.js
+++ b/tests/mocha/shortcut_registry_test.js
@@ -46,7 +46,7 @@ suite('Keyboard Shortcut Registry Test', function() {
const testShortcut = {'name': 'test_shortcut'};
const otherShortcut = {
'name': 'test_shortcut',
- 'callback': function() {}
+ 'callback': function() {},
};
registry.registry_['test_shortcut'] = [testShortcut];
@@ -235,7 +235,7 @@ suite('Keyboard Shortcut Registry Test', function() {
},
'precondition': function() {
return true;
- }
+ },
};
this.callBackStub =
addShortcut(this.registry, this.testShortcut, Blockly.utils.KeyCodes.C, true);
@@ -264,7 +264,7 @@ suite('Keyboard Shortcut Registry Test', function() {
},
'precondition': function() {
return false;
- }
+ },
};
const testShortcut2Stub =
addShortcut(this.registry, testShortcut2, Blockly.utils.KeyCodes.C, false);
@@ -281,7 +281,7 @@ suite('Keyboard Shortcut Registry Test', function() {
},
'precondition': function() {
return false;
- }
+ },
};
const testShortcut2Stub =
addShortcut(this.registry, testShortcut2, Blockly.utils.KeyCodes.C, true);
diff --git a/tests/mocha/test_helpers.js b/tests/mocha/test_helpers.js
index d9b230258..9a404e629 100644
--- a/tests/mocha/test_helpers.js
+++ b/tests/mocha/test_helpers.js
@@ -201,7 +201,7 @@ function sharedTestSetup(options = {}) {
}
this.sharedCleanup = {
blockTypesCleanup_: [],
- messagesCleanup_: []
+ messagesCleanup_: [],
};
this.blockTypesCleanup_ = this.sharedCleanup.blockTypesCleanup_;
this.messagesCleanup_ = this.sharedCleanup.messagesCleanup_;
@@ -488,7 +488,7 @@ function defineStackBlock(name = 'stack_block') {
"type": name,
"message0": "",
"previousStatement": null,
- "nextStatement": null
+ "nextStatement": null,
}]);
}
exports.defineStackBlock = defineStackBlock;
@@ -500,10 +500,10 @@ function defineRowBlock(name = 'row_block') {
"args0": [
{
"type": "input_value",
- "name": "INPUT"
- }
+ "name": "INPUT",
+ },
],
- "output": null
+ "output": null,
}]);
}
exports.defineRowBlock = defineRowBlock;
@@ -515,14 +515,14 @@ function defineStatementBlock(name = 'statement_block') {
"args0": [
{
"type": "input_statement",
- "name": "NAME"
- }
+ "name": "NAME",
+ },
],
"previousStatement": null,
"nextStatement": null,
"colour": 230,
"tooltip": "",
- "helpUrl": ""
+ "helpUrl": "",
}]);
}
exports.defineStatementBlock = defineStatementBlock;
@@ -534,10 +534,10 @@ function defineBasicBlockWithField(name = 'test_field_block') {
"args0": [
{
"type": "field_input",
- "name": "NAME"
- }
+ "name": "NAME",
+ },
],
- "output": null
+ "output": null,
}]);
}
exports.defineBasicBlockWithField = defineBasicBlockWithField;
@@ -546,11 +546,11 @@ function defineMutatorBlocks() {
Blockly.defineBlocksWithJsonArray([
{
'type': 'xml_block',
- 'mutator': 'xml_mutator'
+ 'mutator': 'xml_mutator',
},
{
'type': 'jso_block',
- 'mutator': 'jso_mutator'
+ 'mutator': 'jso_mutator',
},
{
'type': 'checkbox_block',
@@ -558,10 +558,10 @@ function defineMutatorBlocks() {
'args0': [
{
'type': 'field_checkbox',
- 'name': 'CHECK'
- }
- ]
- }
+ 'name': 'CHECK',
+ },
+ ],
+ },
]);
const xmlMutator = {
@@ -596,7 +596,7 @@ function defineMutatorBlocks() {
} else if (!this.hasInput && this.getInput('INPUT')) {
this.removeInput('INPUT');
}
- }
+ },
};
Blockly.Extensions.registerMutator('xml_mutator', xmlMutator);
@@ -630,7 +630,7 @@ function defineMutatorBlocks() {
} else if (!this.hasInput && this.getInput('INPUT')) {
this.removeInput('INPUT');
}
- }
+ },
};
Blockly.Extensions.registerMutator('jso_mutator', jsoMutator);
}
@@ -638,10 +638,10 @@ exports.defineMutatorBlocks = defineMutatorBlocks;
function createTestBlock() {
return {
- id: 'test',
- rendered: false,
- workspace: {
- rendered: false
+ 'id': 'test',
+ 'rendered': false,
+ 'workspace': {
+ 'rendered': false,
},
'isShadow': function() {
return false;
diff --git a/tests/mocha/theme_test.js b/tests/mocha/theme_test.js
index 7f18ad12f..5c8d5d24e 100644
--- a/tests/mocha/theme_test.js
+++ b/tests/mocha/theme_test.js
@@ -24,7 +24,7 @@ suite('Theme', function() {
"type": "stack_block",
"message0": "",
"previousStatement": null,
- "nextStatement": null
+ "nextStatement": null,
},
{
"type": "row_block",
@@ -32,10 +32,10 @@ suite('Theme', function() {
"args0": [
{
"type": "input_value",
- "name": "INPUT"
- }
+ "name": "INPUT",
+ },
],
- "output": null
+ "output": null,
}]);
}
@@ -45,8 +45,8 @@ suite('Theme', function() {
"colourPrimary": "#aaaaaa",
"colourSecondary": "#bbbbbb",
"colourTertiary": "#cccccc",
- "hat": 'cap'
- }
+ "hat": 'cap',
+ },
};
}
@@ -56,14 +56,14 @@ suite('Theme', function() {
"colourPrimary": "#aaaaaa",
"colourSecondary": "#bbbbbb",
"colourTertiary": "#cccccc",
- "hat": 'cap'
+ "hat": 'cap',
},
"styleTwo": {
"colourPrimary": "#000000",
"colourSecondary": "#999999",
"colourTertiary": "#4d4d4d",
- "hat": ''
- }
+ "hat": '',
+ },
};
}
@@ -163,7 +163,7 @@ suite('Theme', function() {
"colourPrimary": "#000000",
"colourSecondary": "#999999",
"colourTertiary": "#4d4d4d",
- "hat": ''
+ "hat": '',
};
stringifyAndCompare(
this.constants.validatedBlockStyle_(inputStyle), expectedOutput);
@@ -175,7 +175,7 @@ suite('Theme', function() {
"colourPrimary": "#000000",
"colourSecondary": "#999999",
"colourTertiary": "#4d4d4d",
- "hat": ''
+ "hat": '',
};
stringifyAndCompare(
this.constants.validatedBlockStyle_(inputStyle), expectedOutput);
@@ -183,13 +183,13 @@ suite('Theme', function() {
test('Incomplete hex', function() {
const inputStyle = {
- "colourPrimary": "#012345"
+ "colourPrimary": "#012345",
};
const expectedOutput = {
"colourPrimary": "#012345",
"colourSecondary": "#99a7b5",
"colourTertiary": "#4d657d",
- "hat": ''
+ "hat": '',
};
stringifyAndCompare(
this.constants.validatedBlockStyle_(inputStyle), expectedOutput);
@@ -200,13 +200,13 @@ suite('Theme', function() {
"colourPrimary": "#aaaaaa",
"colourSecondary": "#bbbbbb",
"colourTertiary": "#cccccc",
- "hat": 'cap'
+ "hat": 'cap',
};
const expectedOutput = {
"colourPrimary": "#aaaaaa",
"colourSecondary": "#bbbbbb",
"colourTertiary": "#cccccc",
- "hat": 'cap'
+ "hat": 'cap',
};
stringifyAndCompare(
this.constants.validatedBlockStyle_(inputStyle), expectedOutput);
@@ -222,7 +222,7 @@ suite('Theme', function() {
"colourPrimary": "#a5745b",
"colourSecondary": "#a58c5b",
"colourTertiary": "#a5a55b",
- "hat": ''
+ "hat": '',
};
stringifyAndCompare(
this.constants.validatedBlockStyle_(inputStyle), expectedOutput);
@@ -236,7 +236,7 @@ suite('Theme', function() {
"colourPrimary": "#a5745b",
"colourSecondary": "#dbc7bd",
"colourTertiary": "#c09e8c",
- "hat": ''
+ "hat": '',
};
stringifyAndCompare(
this.constants.validatedBlockStyle_(inputStyle), expectedOutput);
@@ -246,13 +246,13 @@ suite('Theme', function() {
const inputStyle = {
"colourPrimary": "red",
"colourSecondary": "white",
- "colourTertiary": "blue"
+ "colourTertiary": "blue",
};
const expectedOutput = {
"colourPrimary": "#ff0000",
"colourSecondary": "#ffffff",
"colourTertiary": "#0000ff",
- "hat": ''
+ "hat": '',
};
stringifyAndCompare(
this.constants.validatedBlockStyle_(inputStyle), expectedOutput);
@@ -266,7 +266,7 @@ suite('Theme', function() {
"colourPrimary": "#000000",
"colourSecondary": "#999999",
"colourTertiary": "#4d4d4d",
- "hat": ''
+ "hat": '',
};
stringifyAndCompare(
this.constants.validatedBlockStyle_(inputStyle), expectedOutput);
diff --git a/tests/mocha/toolbox_helper.js b/tests/mocha/toolbox_helper.js
index 12351334f..bc62d8384 100644
--- a/tests/mocha/toolbox_helper.js
+++ b/tests/mocha/toolbox_helper.js
@@ -17,29 +17,29 @@ function getCategoryJSON() {
{
"kind": "CATEGORY",
"cssconfig": {
- "container": "something"
+ "container": "something",
},
"contents": [
{
"kind": "BLOCK",
- "blockxml": 'FirstCategory-FirstBlock'
+ "blockxml": 'FirstCategory-FirstBlock',
},
{
"kind": "BLOCK",
- "blockxml": 'FirstCategory-SecondBlock'
- }
+ "blockxml": 'FirstCategory-SecondBlock',
+ },
],
- "name": "First"
+ "name": "First",
},
{
"kind": "CATEGORY",
"contents": [
{
"kind": "BLOCK",
- "blockxml": 'SecondCategory-FirstBlock'
- }
+ "blockxml": 'SecondCategory-FirstBlock',
+ },
],
- "name": "Second"
+ "name": "Second",
}]};
}
exports.getCategoryJSON = getCategoryJSON;
@@ -50,9 +50,9 @@ exports.getCategoryJSON = getCategoryJSON;
* for a simple toolbox.
*/
function getSimpleJson() {
- return {"contents":[
+ return {"contents": [
{
- "kind":"BLOCK",
+ "kind": "BLOCK",
"blockxml":
`
NEQ
@@ -69,18 +69,18 @@ function getSimpleJson() {
`,
},
{
- "kind":"SEP",
- "gap":"20"
+ "kind": "SEP",
+ "gap": "20",
},
{
- "kind":"BUTTON",
+ "kind": "BUTTON",
"text": "insert",
- "callbackkey": "insertConnectionRows"
+ "callbackkey": "insertConnectionRows",
},
{
- "kind":"LABEL",
- "text":"tooltips"
- }
+ "kind": "LABEL",
+ "text": "tooltips",
+ },
]};
}
exports.getSimpleJson = getSimpleJson;
@@ -89,7 +89,7 @@ function getProperSimpleJson() {
return {
"contents": [
{
- "kind":"BLOCK",
+ "kind": "BLOCK",
"type": "logic_compare",
"fields": {
"OP": "NEQ",
@@ -100,32 +100,32 @@ function getProperSimpleJson() {
"type": "math_number",
"fields": {
"NUM": 1,
- }
- }
+ },
+ },
},
"B": {
"block": {
"type": "math_number",
"fields": {
"NUM": 2,
- }
- }
- }
- }
+ },
+ },
+ },
+ },
},
{
- "kind":"SEP",
- "gap":"20"
+ "kind": "SEP",
+ "gap": "20",
},
{
- "kind":"BUTTON",
+ "kind": "BUTTON",
"text": "insert",
- "callbackkey": "insertConnectionRows"
+ "callbackkey": "insertConnectionRows",
},
{
- "kind":"LABEL",
- "text":"tooltips"
- }
+ "kind": "LABEL",
+ "text": "tooltips",
+ },
]};
}
exports.getProperSimpleJson = getProperSimpleJson;
@@ -140,7 +140,7 @@ function getDeeplyNestedJSON() {
{
"kind": "CATEGORY",
"cssconfig": {
- "container": "something"
+ "container": "something",
},
"contents": [{
"kind": "CATEGORY",
@@ -149,28 +149,28 @@ function getDeeplyNestedJSON() {
"contents": [
{
"kind": "BLOCK",
- "blockxml": 'NestedCategory-FirstBlock'
+ "blockxml": 'NestedCategory-FirstBlock',
},
{
"kind": "BLOCK",
- "blockxml": 'NestedCategory-SecondBlock'
- }
+ "blockxml": 'NestedCategory-SecondBlock',
+ },
],
- "name": "NestedCategoryInner"
+ "name": "NestedCategoryInner",
}],
"name": "NestedCategoryMiddle",
}],
- "name": "NestedCategoryOuter"
+ "name": "NestedCategoryOuter",
},
{
"kind": "CATEGORY",
"contents": [
{
"kind": "BLOCK",
- "blockxml": 'SecondCategory-FirstBlock'
- }
+ "blockxml": 'SecondCategory-FirstBlock',
+ },
],
- "name": "Second"
+ "name": "Second",
}]};
}
exports.getDeeplyNestedJSON = getDeeplyNestedJSON;
@@ -217,7 +217,7 @@ function getInjectedToolbox() {
const toolboxXml = document.getElementById('toolbox-test');
const workspace = Blockly.inject('blocklyDiv',
{
- toolbox: toolboxXml
+ toolbox: toolboxXml,
});
return workspace.getToolbox();
}
diff --git a/tests/mocha/toolbox_test.js b/tests/mocha/toolbox_test.js
index 2003bfb54..acaededd5 100644
--- a/tests/mocha/toolbox_test.js
+++ b/tests/mocha/toolbox_test.js
@@ -11,7 +11,6 @@ const {getBasicToolbox, getCategoryJSON, getChildItem, getCollapsibleItem, getDe
suite('Toolbox', function() {
-
setup(function() {
sharedTestSetup.call(this);
defineStackBlock();
@@ -74,7 +73,7 @@ suite('Toolbox', function() {
const positionStub = sinon.stub(this.toolbox, 'position');
this.toolbox.render({'contents': [
{'kind': 'category', 'contents': []},
- {'kind': 'category', 'contents': []}
+ {'kind': 'category', 'contents': []},
]});
chai.assert.lengthOf(this.toolbox.contents_, 2);
sinon.assert.called(positionStub);
@@ -84,14 +83,14 @@ suite('Toolbox', function() {
const toolbox = this.toolbox;
const badToolboxDef = [
{
- "kind": "block"
+ "kind": "block",
},
{
"kind": "category",
- }
+ },
];
chai.assert.throws(function() {
- toolbox.render({'contents' : badToolboxDef});
+ toolbox.render({'contents': badToolboxDef});
}, 'Toolbox cannot have both blocks and categories in the root level.');
});
// TODO: Uncomment once implemented.
@@ -101,31 +100,31 @@ suite('Toolbox', function() {
chai.assert.isTrue(selectedNode.selected_);
});
test('JSON toolbox definition -> Should create toolbox with contents', function() {
- const jsonDef = {'contents' : [
+ const jsonDef = {'contents': [
{
"kind": "category",
"contents": [
{
"kind": "block",
- "blockxml": 'FirstCategory-FirstBlock'
+ "blockxml": 'FirstCategory-FirstBlock',
},
{
"kind": "label",
"text": "Input/Output:",
- "web-class": "ioLabel"
+ "web-class": "ioLabel",
},
{
"kind": "button",
"text": "insert",
"callbackkey": "insertConnectionStacks",
- "web-class": "ioLabel"
+ "web-class": "ioLabel",
},
{
"kind": "sep",
- "gap": "7"
- }
- ]
- }
+ "gap": "7",
+ },
+ ],
+ },
]};
this.toolbox.render(jsonDef);
chai.assert.lengthOf(this.toolbox.contents_, 1);
@@ -150,7 +149,7 @@ suite('Toolbox', function() {
test('Category clicked -> Should select category', function() {
const categoryXml = document.getElementsByClassName('blocklyTreeRow')[0];
const evt = {
- 'target': categoryXml
+ 'target': categoryXml,
};
const item = this.toolbox.contentMap_[categoryXml.getAttribute('id')];
const setSelectedSpy = sinon.spy(this.toolbox, 'setSelectedItem');
@@ -172,7 +171,7 @@ suite('Toolbox', function() {
function createKeyDownMock(keyCode) {
return {
'keyCode': keyCode,
- 'preventDefault': function() {}
+ 'preventDefault': function() {},
};
}
@@ -563,13 +562,13 @@ suite('Toolbox', function() {
'contents': [
{
'kind': 'block',
- 'type': 'controls_if'
+ 'type': 'controls_if',
},
{
'kind': 'block',
- 'type': 'controls_if'
- }
- ]
+ 'type': 'controls_if',
+ },
+ ],
};
const toolboxDef = Blockly.utils.toolbox.convertToolboxDefToJson(toolbox);
@@ -586,13 +585,13 @@ suite('Toolbox', function() {
'contents': [
{
'kind': 'category',
- 'name': 'a'
+ 'name': 'a',
},
{
'kind': 'category',
- 'name': 'b'
- }
- ]
+ 'name': 'b',
+ },
+ ],
};
const toolboxDef = Blockly.utils.toolbox.convertToolboxDefToJson(toolbox);
diff --git a/tests/mocha/tooltip_test.js b/tests/mocha/tooltip_test.js
index cd3cfaf10..a2c5bb216 100644
--- a/tests/mocha/tooltip_test.js
+++ b/tests/mocha/tooltip_test.js
@@ -10,7 +10,6 @@ const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('B
suite('Tooltip', function() {
-
setup(function() {
sharedTestSetup.call(this);
this.workspace = new Blockly.Workspace();
@@ -29,10 +28,10 @@ suite('Tooltip', function() {
"args0": [
{
"type": "field_input",
- "name": "FIELD"
- }
- ]
- }
+ "name": "FIELD",
+ },
+ ],
+ },
]);
});
@@ -67,7 +66,7 @@ suite('Tooltip', function() {
function setFunctionReturningObjectTooltip(obj) {
obj.setTooltip(() => {
return {
- tooltip: tooltipText
+ tooltip: tooltipText,
};
});
}
diff --git a/tests/mocha/variables_test.js b/tests/mocha/variables_test.js
index d1bbf7208..fb27ec14a 100644
--- a/tests/mocha/variables_test.js
+++ b/tests/mocha/variables_test.js
@@ -20,9 +20,9 @@ suite('Variables', function() {
{
"type": "field_variable",
"name": "VAR",
- "variableTypes": ["", "type1", "type2"]
- }
- ]
+ "variableTypes": ["", "type1", "type2"],
+ },
+ ],
}]);
this.workspace.createVariable('foo', 'type1', '1');
this.workspace.createVariable('bar', 'type1', '2');
@@ -38,14 +38,14 @@ suite('Variables', function() {
* Will fail if get_var_block isn't defined.
* @param {!Blockly.Workspace} workspace The workspace on which to create the
* block.
- * @param {!string} variable_id The id of the variable to reference.
+ * @param {!string} variableId The id of the variable to reference.
* @return {!Blockly.Block} The created block.
*/
- function createTestVarBlock(workspace, variable_id) {
+ function createTestVarBlock(workspace, variableId) {
// Turn off events to avoid testing XML at the same time.
Blockly.Events.disable();
const block = new Blockly.Block(workspace, 'get_var_block');
- block.inputList[0].fieldRow[0].setValue(variable_id);
+ block.inputList[0].fieldRow[0].setValue(variableId);
Blockly.Events.enable();
return block;
}
diff --git a/tests/mocha/widget_div_test.js b/tests/mocha/widget_div_test.js
index 0855cfb9f..8e91545bd 100644
--- a/tests/mocha/widget_div_test.js
+++ b/tests/mocha/widget_div_test.js
@@ -25,7 +25,7 @@ suite('WidgetDiv', function() {
top: top,
bottom: top + height,
width: width,
- height: height
+ height: height,
};
}
@@ -34,11 +34,11 @@ suite('WidgetDiv', function() {
this.viewportBBox = makeBBox(0, 0, 1000, 1003);
this.widgetSize = {
width: 100,
- height: 102
+ height: 102,
};
this.anchorSize = {
width: 90,
- height: 91
+ height: 91,
};
this.testWidgetPosition = function(
diff --git a/tests/mocha/workspace_comment_test.js b/tests/mocha/workspace_comment_test.js
index f68059b60..c48e70ee2 100644
--- a/tests/mocha/workspace_comment_test.js
+++ b/tests/mocha/workspace_comment_test.js
@@ -163,12 +163,10 @@ suite('Workspace comment', function() {
chai.assert.equal(xy.x, 10, 'New X position');
chai.assert.equal(xy.y, 100, 'New Y position');
});
-
});
suite('Content', function() {
setup(function() {
-
this.comment = new Blockly.WorkspaceComment(
this.workspace, 'comment text', 0, 0, 'comment id');
});
diff --git a/tests/mocha/workspace_helpers.js b/tests/mocha/workspace_helpers.js
index 353c5841e..04aa9939d 100644
--- a/tests/mocha/workspace_helpers.js
+++ b/tests/mocha/workspace_helpers.js
@@ -19,9 +19,9 @@ function testAWorkspace() {
{
"type": "field_variable",
"name": "VAR",
- "variableTypes": ["", "type1", "type2"]
- }
- ]
+ "variableTypes": ["", "type1", "type2"],
+ },
+ ],
}]);
});
@@ -633,7 +633,6 @@ function testAWorkspace() {
});
suite('Undo/Redo', function() {
-
/**
* Assert that two nodes are equal.
* @param {!Element} actual the actual node.
@@ -664,7 +663,7 @@ function testAWorkspace() {
"type": "stack_block",
"message0": "",
"previousStatement": null,
- "nextStatement": null
+ "nextStatement": null,
},
{
"type": "row_block",
@@ -672,10 +671,10 @@ function testAWorkspace() {
"args0": [
{
"type": "input_value",
- "name": "INPUT"
- }
+ "name": "INPUT",
+ },
],
- "output": null
+ "output": null,
},
{
"type": "statement_block",
@@ -683,11 +682,11 @@ function testAWorkspace() {
"args0": [
{
"type": "input_statement",
- "name": "STATEMENT"
- }
+ "name": "STATEMENT",
+ },
],
"previousStatement": null,
- "nextStatement": null
+ "nextStatement": null,
}]);
});
@@ -780,14 +779,13 @@ function testAWorkspace() {
});
suite('Undo Connect', function() {
-
setup(function() {
Blockly.defineBlocksWithJsonArray([
{
"type": "stack_block",
"message0": "",
"previousStatement": null,
- "nextStatement": null
+ "nextStatement": null,
},
{
"type": "row_block",
@@ -795,10 +793,10 @@ function testAWorkspace() {
"args0": [
{
"type": "input_value",
- "name": "INPUT"
- }
+ "name": "INPUT",
+ },
],
- "output": null
+ "output": null,
},
{
"type": "statement_block",
@@ -806,11 +804,11 @@ function testAWorkspace() {
"args0": [
{
"type": "input_statement",
- "name": "STATEMENT"
- }
+ "name": "STATEMENT",
+ },
],
"previousStatement": null,
- "nextStatement": null
+ "nextStatement": null,
}]);
});
@@ -970,14 +968,13 @@ function testAWorkspace() {
});
suite('Undo Disconnect', function() {
-
setup(function() {
Blockly.defineBlocksWithJsonArray([
{
"type": "stack_block",
"message0": "",
"previousStatement": null,
- "nextStatement": null
+ "nextStatement": null,
},
{
"type": "row_block",
@@ -985,10 +982,10 @@ function testAWorkspace() {
"args0": [
{
"type": "input_value",
- "name": "INPUT"
- }
+ "name": "INPUT",
+ },
],
- "output": null
+ "output": null,
},
{
"type": "statement_block",
@@ -996,11 +993,11 @@ function testAWorkspace() {
"args0": [
{
"type": "input_statement",
- "name": "STATEMENT"
- }
+ "name": "STATEMENT",
+ },
],
"previousStatement": null,
- "nextStatement": null
+ "nextStatement": null,
}]);
});
@@ -1364,7 +1361,6 @@ function testAWorkspace() {
this.workspace.undo(true);
assertVariableValues(this.workspace, 'name2', 'type1', 'id1');
-
});
test('Reference exists with usages rename to name2', function() {
diff --git a/tests/mocha/workspace_svg_test.js b/tests/mocha/workspace_svg_test.js
index 843719b72..c6af088ec 100644
--- a/tests/mocha/workspace_svg_test.js
+++ b/tests/mocha/workspace_svg_test.js
@@ -18,7 +18,7 @@ suite('WorkspaceSvg', function() {
Blockly.defineBlocksWithJsonArray([{
'type': 'simple_test_block',
'message0': 'simple test block',
- 'output': null
+ 'output': null,
},
{
'type': 'test_val_in',
@@ -26,9 +26,9 @@ suite('WorkspaceSvg', function() {
'args0': [
{
'type': 'input_value',
- 'name': 'NAME'
- }
- ]
+ 'name': 'NAME',
+ },
+ ],
}]);
});
@@ -132,9 +132,9 @@ suite('WorkspaceSvg', function() {
{
"type": "field_variable",
"name": "VAR",
- "variableTypes": ["", "type1", "type2"]
- }
- ]
+ "variableTypes": ["", "type1", "type2"],
+ },
+ ],
}]);
});
@@ -181,7 +181,7 @@ suite('WorkspaceSvg', function() {
scale: workspace.scale,
oldScale: 1,
viewTop: metrics.viewTop,
- viewLeft: metrics.viewLeft
+ viewLeft: metrics.viewLeft,
};
assertSpyFiredViewportEvent(
eventsFireStub, workspace, expectedProperties);
@@ -274,7 +274,7 @@ suite('WorkspaceSvg', function() {
}, this.eventsFireStub, this.changeListenerSpy, this.workspace,
this.clock, 2);
});
- test('domToWorkspace that doesn\'t trigger scroll' , function() {
+ test('domToWorkspace that doesn\'t trigger scroll', function() {
// 4 blocks with space in center.
Blockly.Xml.domToWorkspace(
Blockly.Xml.textToDom(
@@ -298,7 +298,7 @@ suite('WorkspaceSvg', function() {
assertEventNotFired(
this.changeListenerSpy, Blockly.Events.ViewportChange, {});
});
- test('domToWorkspace at 0,0 that doesn\'t trigger scroll' , function() {
+ test('domToWorkspace at 0,0 that doesn\'t trigger scroll', function() {
// 4 blocks with space in center.
Blockly.Xml.domToWorkspace(
Blockly.Xml.textToDom(
diff --git a/tests/mocha/xml_test.js b/tests/mocha/xml_test.js
index c98a77156..7354d6370 100644
--- a/tests/mocha/xml_test.js
+++ b/tests/mocha/xml_test.js
@@ -38,7 +38,7 @@ suite('XML', function() {
{
"type": "empty_block",
"message0": "",
- "args0": []
+ "args0": [],
},
]);
this.complexXmlText = [
@@ -95,8 +95,8 @@ suite('XML', function() {
{
"type": "field_angle",
"name": "ANGLE",
- "angle": 90
- }
+ "angle": 90,
+ },
],
}]);
const block = new Blockly.Block(this.workspace,
@@ -112,8 +112,8 @@ suite('XML', function() {
{
"type": "field_checkbox",
"name": "CHECKBOX",
- "checked": true
- }
+ "checked": true,
+ },
],
}]);
const block = new Blockly.Block(this.workspace,
@@ -129,8 +129,8 @@ suite('XML', function() {
{
"type": "field_colour",
"name": "COLOUR",
- "colour": '#000099'
- }
+ "colour": '#000099',
+ },
],
}]);
const block = new Blockly.Block(this.workspace,
@@ -149,18 +149,18 @@ suite('XML', function() {
"options": [
[
"a",
- "A"
+ "A",
],
[
"b",
- "B"
+ "B",
],
[
"c",
- "C"
- ]
- ]
- }
+ "C",
+ ],
+ ],
+ },
],
}]);
const block = new Blockly.Block(this.workspace,
@@ -179,8 +179,8 @@ suite('XML', function() {
"src": "https://blockly-demo.appspot.com/static/tests/media/a.png",
"width": 32,
"height": 32,
- "alt": "A"
- }
+ "alt": "A",
+ },
],
}]);
const block = new Blockly.Block(this.workspace,
@@ -196,8 +196,8 @@ suite('XML', function() {
{
"type": "field_label",
"name": "LABEL",
- "text": "default"
- }
+ "text": "default",
+ },
],
}]);
const block = new Blockly.Block(this.workspace,
@@ -213,8 +213,8 @@ suite('XML', function() {
{
"type": "field_label_serializable",
"name": "LABEL",
- "text": "default"
- }
+ "text": "default",
+ },
],
}]);
const block = new Blockly.Block(this.workspace,
@@ -230,8 +230,8 @@ suite('XML', function() {
{
"type": "field_number",
"name": "NUMBER",
- "value": 97
- }
+ "value": 97,
+ },
],
}]);
const block = new Blockly.Block(this.workspace,
@@ -247,8 +247,8 @@ suite('XML', function() {
{
"type": "field_input",
"name": "TEXT",
- "text": "default"
- }
+ "text": "default",
+ },
],
}]);
const block = new Blockly.Block(this.workspace,
@@ -265,9 +265,9 @@ suite('XML', function() {
{
'type': 'field_variable',
'name': 'VAR',
- 'variable': 'item'
- }
- ]
+ 'variable': 'item',
+ },
+ ],
}]);
});
test('Variable Trivial', function() {
@@ -390,9 +390,9 @@ suite('XML', function() {
{
'type': 'field_variable',
'name': 'VAR',
- 'variable': 'item'
- }
- ]
+ 'variable': 'item',
+ },
+ ],
}]);
});
teardown(function() {
@@ -613,9 +613,9 @@ suite('XML', function() {
{
'type': 'field_variable',
'name': 'VAR',
- 'variable': 'item'
- }
- ]
+ 'variable': 'item',
+ },
+ ],
}]);
});
teardown(function() {
@@ -700,7 +700,7 @@ suite('XML', function() {
this.jsonInit({
message0: 'test',
});
- }
+ },
};
this.workspace = new Blockly.Workspace();
});
@@ -723,7 +723,7 @@ suite('XML', function() {
suite('workspaceToDom -> domToWorkspace -> workspaceToDom', function() {
setup(function() {
const options = {
- comments: true
+ comments: true,
};
this.renderedWorkspace = Blockly.inject('blocklyDiv', options);
this.headlessWorkspace =
@@ -780,7 +780,7 @@ suite('XML', function() {
name: name,
getId: function() {
return varId;
- }
+ },
};
const generatedXml = Blockly.Xml.domToText(