mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
Migrate selected from Blockly to Blockly.common (#5489)
* Add getSelected/setSelected to core/common.js * Migrate core to use Blockly.common.getSelected/setSelected instead of Blockly.selected * Migrate demos to use Blockly.common.getSelected/setSelected instead of Blockly.selected * Remove Blockly.selected * Use variable instead of calling common.getSelected() multiple times * Add accessor for selected on Blockly * Add renaming record for Blockly.selected -> Blockly.common.getSelected/setSelected
This commit is contained in:
@@ -24,7 +24,7 @@ suite('Key Down', function() {
|
||||
*/
|
||||
function setSelectedBlock(workspace) {
|
||||
defineStackBlock();
|
||||
Blockly.selected = workspace.newBlock('stack_block');
|
||||
Blockly.common.setSelected(workspace.newBlock('stack_block'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ suite('Key Down', function() {
|
||||
this.hideChaffSpy = sinon.spy(
|
||||
Blockly.WorkspaceSvg.prototype, 'hideChaff');
|
||||
setSelectedBlock(this.workspace);
|
||||
this.deleteSpy = sinon.spy(Blockly.selected, 'dispose');
|
||||
this.deleteSpy = sinon.spy(Blockly.common.getSelected(), 'dispose');
|
||||
});
|
||||
var testCases = [
|
||||
['Delete', createKeyDownEvent(Blockly.utils.KeyCodes.DELETE)],
|
||||
@@ -149,7 +149,7 @@ suite('Key Down', function() {
|
||||
var testCaseName = testCase[0];
|
||||
var keyEvent = testCase[1];
|
||||
test(testCaseName, function() {
|
||||
sinon.stub(Blockly.selected, 'isDeletable').returns(false);
|
||||
sinon.stub(Blockly.common.getSelected(), 'isDeletable').returns(false);
|
||||
document.dispatchEvent(keyEvent);
|
||||
sinon.assert.notCalled(this.copySpy);
|
||||
sinon.assert.notCalled(this.hideChaffSpy);
|
||||
@@ -162,7 +162,7 @@ suite('Key Down', function() {
|
||||
var testCaseName = testCase[0];
|
||||
var keyEvent = testCase[1];
|
||||
test(testCaseName, function() {
|
||||
sinon.stub(Blockly.selected, 'isMovable').returns(false);
|
||||
sinon.stub(Blockly.common.getSelected(), 'isMovable').returns(false);
|
||||
document.dispatchEvent(keyEvent);
|
||||
sinon.assert.notCalled(this.copySpy);
|
||||
sinon.assert.notCalled(this.hideChaffSpy);
|
||||
|
||||
@@ -66,7 +66,6 @@ async function runMochaTestsInBrowser() {
|
||||
console.log(numOfFailure + ' tests failed');
|
||||
console.log('============Blockly Mocha Test Summary=================');
|
||||
if (parseInt(numOfFailure) !== 0) {
|
||||
await browser.deleteSession();
|
||||
return 1;
|
||||
}
|
||||
await browser.deleteSession();
|
||||
|
||||
Reference in New Issue
Block a user