mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
chore: merge develop into rc/v11
This commit is contained in:
@@ -513,7 +513,7 @@ function mathModes(values) {
|
||||
}
|
||||
for (var j = 0; j < counts.length; j++) {
|
||||
if (counts[j][1] === maxCount) {
|
||||
modes.push(counts[j][0]);
|
||||
modes.push(counts[j][0]);
|
||||
}
|
||||
}
|
||||
return modes;
|
||||
@@ -527,7 +527,7 @@ function mathStandardDeviation(numbers) {
|
||||
for (var j = 0; j < n; j++) {
|
||||
variance += Math.pow(numbers[j] - mean, 2);
|
||||
}
|
||||
variance = variance / n;
|
||||
variance /= n;
|
||||
return Math.sqrt(variance);
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ dartGenerator.forBlock['unittest_adjustindex'] = function(block) {
|
||||
return [Number(index) + 1, dartGenerator.ORDER_ATOMIC];
|
||||
} else {
|
||||
// If the index is dynamic, adjust it in code.
|
||||
index = index + ' + 1';
|
||||
index += ' + 1';
|
||||
}
|
||||
} else if (Blockly.utils.string.isNumber(index)) {
|
||||
return [index, dartGenerator.ORDER_ATOMIC];
|
||||
|
||||
@@ -158,7 +158,7 @@ javascriptGenerator.forBlock['unittest_adjustindex'] = function(block) {
|
||||
return [Number(index) + 1, javascriptGenerator.ORDER_ATOMIC];
|
||||
} else {
|
||||
// If the index is dynamic, adjust it in code.
|
||||
index = index + ' + 1';
|
||||
index += ' + 1';
|
||||
}
|
||||
} else if (Blockly.utils.string.isNumber(index)) {
|
||||
return [index, javascriptGenerator.ORDER_ATOMIC];
|
||||
|
||||
@@ -145,7 +145,7 @@ phpGenerator.forBlock['unittest_adjustindex'] = function(block) {
|
||||
return [Number(index) + 1, phpGenerator.ORDER_ATOMIC];
|
||||
} else {
|
||||
// If the index is dynamic, adjust it in code.
|
||||
index = index + ' + 1';
|
||||
index += ' + 1';
|
||||
}
|
||||
} else if (Blockly.utils.string.isNumber(index)) {
|
||||
return [index, phpGenerator.ORDER_ATOMIC];
|
||||
|
||||
@@ -129,7 +129,7 @@ pythonGenerator.forBlock['unittest_adjustindex'] = function(block) {
|
||||
return [Number(index) + 1, pythonGenerator.ORDER_ATOMIC];
|
||||
} else {
|
||||
// If the index is dynamic, adjust it in code.
|
||||
index = index + ' + 1';
|
||||
index += ' + 1';
|
||||
}
|
||||
} else if (Blockly.utils.string.isNumber(index)) {
|
||||
return [index, pythonGenerator.ORDER_ATOMIC];
|
||||
|
||||
@@ -47,6 +47,15 @@ suite('Registry', function () {
|
||||
test('Overwrite a Key', function () {
|
||||
Blockly.registry.register('test', 'test_name', TestClass);
|
||||
chai.assert.throws(function () {
|
||||
// Registers a different object under the same name
|
||||
Blockly.registry.register('test', 'test_name', {});
|
||||
}, 'already registered');
|
||||
});
|
||||
|
||||
test('Register a Duplicate Item', function () {
|
||||
Blockly.registry.register('test', 'test_name', TestClass);
|
||||
chai.assert.doesNotThrow(function () {
|
||||
// Registering the same object under the same name is allowed
|
||||
Blockly.registry.register('test', 'test_name', TestClass);
|
||||
}, 'already registered');
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ export const COMPRESSED = compressed();
|
||||
*
|
||||
* When loading in uncompressed mode, if scriptExports is a simple
|
||||
* variable name (e.g. 'Blockly') then globalThis[scriptExports] will
|
||||
* be set to the the chunk's Module object. This attempts to provide
|
||||
* be set to the chunk's Module object. This attempts to provide
|
||||
* backward compatibility with loading the compressed chunk as a
|
||||
* script, where this is done by the compressed chunk's UMD wrapper.
|
||||
* The compatibility is not complete, however: since Module objects
|
||||
|
||||
Reference in New Issue
Block a user