diff --git a/src/move_indicator.ts b/src/move_indicator.ts index e6f8e92b..caa5b09e 100644 --- a/src/move_indicator.ts +++ b/src/move_indicator.ts @@ -38,6 +38,7 @@ export class MoveIndicatorBubble {}, workspace.getBubbleCanvas(), ); + this.svgRoot.classList.add('blocklyMoveIndicatorBubble'); const rtl = workspace.RTL; Blockly.utils.dom.createSvgElement( Blockly.utils.Svg.CIRCLE, diff --git a/test/webdriverio/test/move_test.ts b/test/webdriverio/test/move_test.ts index aa441910..34c38313 100644 --- a/test/webdriverio/test/move_test.ts +++ b/test/webdriverio/test/move_test.ts @@ -45,12 +45,15 @@ suite('Move start tests', function () { // and block connected to selected block's next connection. const info = await getFocusedNeighbourInfo(this.browser); - chai.assert(info.parentId, 'selected block has no parent block'); + chai.assert.exists( + info.parentId, + 'selected block should have parent block', + ); chai.assert( typeof info.parentIndex === 'number', - 'parent connection index not found', + 'parent connection index should exist and be a number', ); - chai.assert(info.nextId, 'selected block has no next block'); + chai.assert.exists(info.nextId, 'selected block should have next block'); // Start move using keyboard shortcut. await sendKeyAndWait(this.browser, 'm'); @@ -59,12 +62,12 @@ suite('Move start tests', function () { // next/previous connections, and same thing connected to value // input. const newInfo = await getFocusedNeighbourInfo(this.browser); - chai.assert( - newInfo.parentId === null, + chai.assert.isNull( + newInfo.parentId, 'moving block should have no parent block', ); - chai.assert( - newInfo.nextId === null, + chai.assert.isNull( + newInfo.nextId, 'moving block should have no next block', ); chai.assert.strictEqual( @@ -106,34 +109,47 @@ suite('Move start tests', function () { // and block connected to selected block's value input. const info = await getFocusedNeighbourInfo(this.browser); - chai.assert(info.parentId, 'selected block has no parent block'); + chai.assert.exists( + info.parentId, + 'selected block should have parent block', + ); chai.assert( typeof info.parentIndex === 'number', - 'parent connection index not found', + 'parent connection index should exist and be a number', + ); + chai.assert.exists( + info.valueId, + 'selected block should have child value block', ); - chai.assert(info.valueId, 'selected block has no child value block'); // Start move using context menu (using keyboard nav). await sendKeyAndWait(this.browser, [Key.Ctrl, Key.Return]); - await sendKeyAndWait(this.browser, 'm'); - await keyDown( - this.browser, - (await contextMenuItems(this.browser)).findIndex(({text}) => - text.includes('Move'), - ), + + // Find how many times to press the down arrow + const index = (await contextMenuItems(this.browser)).findIndex(({text}) => + text.includes('Move'), + ); + chai.assert.isAbove( + index, + -1, + 'expected Move to appear in context menu items', ); + await keyDown(this.browser, index); await sendKeyAndWait(this.browser, Key.Return); + // Wait for the move icon to appear so we know we're in move mode. + await this.browser.$('.blocklyMoveIndicatorBubble').waitForExist(); + // Check that the moving block has nothing connected it its // next/previous connections, and same thing connected to value // input. const newInfo = await getFocusedNeighbourInfo(this.browser); - chai.assert( - newInfo.parentId === null, + chai.assert.isNull( + newInfo.parentId, 'moving block should have no parent block', ); - chai.assert( - newInfo.nextId === null, + chai.assert.isNull( + newInfo.nextId, 'moving block should have no next block', ); chai.assert.strictEqual(