Skip to content

Commit cb2f68e

Browse files
GermanBluefoxclaude
andcommitted
Fixed flaky Blockly test: wait for the events of the mutator dialog
compose runs in a change listener, and Blockly 13 fires the events in a setTimeout scheduled from the next frame - after finishQueuedRenders(). On a slow runner the first test saw no parameter at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5c99b4b commit cb2f68e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎test/testBlocklyProcedureArgs.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ describe('Blockly JavaScript function blocks', function () {
8282
connection = arg.nextConnection;
8383
}
8484
await Blockly.renderManagement.finishQueuedRenders();
85+
// `compose` runs in a change listener of the dialog, and Blockly fires the events of a change in a
86+
// `setTimeout` it schedules from the next frame (`fireInternal` in core/events/utils.ts) - after the
87+
// renders are finished. Mocha's next step raced with it: on a slow runner the first test saw no
88+
// parameter at all. A timeout scheduled from the frame after that runs after the events.
89+
await new Promise(resolve => env.window.requestAnimationFrame(() => env.window.setTimeout(resolve, 0)));
8590

8691
return def;
8792
}

0 commit comments

Comments
 (0)