Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions packages/blockly/core/gesture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -975,9 +975,17 @@ export class Gesture {
* @internal
*/
setStartBlock(block: BlockSvg) {
// If the gesture already went through a block child, don't set the start
// block.
if (!this.startBlock && !this.startBubble && !this.startIcon) {
// If the gesture already went through a clickable block child, don't set
// the start block.
if (
!this.startBlock &&
!this.startBubble &&
(!this.startIcon ||
(block.isInFlyout &&
!this.startIcon.isClickableInFlyout?.(
!!block.workspace.getFlyout()?.autoClose,
)))
) {
this.startBlock = block;
if (block.isInFlyout && block !== block.getRootBlock()) {
this.setTargetBlock(block.getRootBlock());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ suite('Focused nodes are scrolled into bounds', function () {
await this.browser.execute(() => {
window.focusScrollTest = async (testcase) => {
const workspace = Blockly.getMainWorkspace();
Blockly.getFocusManager().focusNode(workspace);
const metrics = workspace.getMetricsManager();
const initialViewport = metrics.getViewMetrics(true);
const elementBounds = await testcase(workspace);
Expand Down
24 changes: 17 additions & 7 deletions packages/blockly/tests/browser/test/test_setup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,14 @@ export async function getSelectedBlockElement(browser) {
/**
* @param browser The active WebdriverIO Browser object.
* @param id The ID of the Blockly block to search for.
* @param toolbox True if this block is in the toolbox (which must be open already).
* @return A Promise that resolves to the root SVG element of the block with
* the given ID, as an interactable browser element.
*/
export async function getBlockElementById(browser, id) {
const elem = await browser.$(`[data-id="${id}"]`);
export async function getBlockElementById(browser, id, toolbox) {
const elem = await browser.$(
`${toolbox ? '' : '.blocklySvg'} [data-id="${id}"]`,
);
elem['id'] = id;
return elem;
}
Expand Down Expand Up @@ -245,7 +248,7 @@ async function getTargetableBlockElement(browser, blockId, toolbox) {
toolbox,
);

return await getBlockElementById(browser, id);
return await getBlockElementById(browser, id, toolbox);
}

/**
Expand Down Expand Up @@ -584,9 +587,14 @@ export async function contextMenuSelect(browser, block, itemText) {
await clickBlock(browser, block.id, {button: 2});

await browser.pause(PAUSE_TIME);
const item = await browser.$(`div=${itemText}`);
await item.waitForExist();
await item.click();
const items = await browser.$$('.blocklyMenuItemContent');
for (const item of items) {
const text = await item.getText();
if (text.includes(itemText)) {
await item.click();
break;
}
}

await browser.pause(PAUSE_TIME);
}
Expand All @@ -599,7 +607,9 @@ export async function contextMenuSelect(browser, block, itemText) {
* @return A Promise that resolves when the actions are complete.
*/
export async function openMutatorForBlock(browser, block) {
const icon = await browser.$(`[data-id="${block.id}"] > g.blocklyIconGroup`);
const icon = await browser.$(
`.blocklySvg [data-id="${block.id}"] > g.blocklyIconGroup`,
);
await icon.click();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ suite('Workspace comments', function () {
const textArea = await this.browser.$('.blocklyComment .blocklyTextarea');
await textArea.addValue('test text');
// Deselect text area to fire browser change event.
await this.browser.$('.blocklyWorkspace').click();
await this.browser.execute(() => {
Blockly.getFocusManager().focusNode(Blockly.getMainWorkspace());
});

chai.assert.equal(
await getCommentText(this.browser, commentId),
Expand Down
Loading