fix: check for a drag specifically rather than a gesture for shortcuts (#9194)

This commit is contained in:
Maribeth Moffatt
2025-07-07 09:49:38 -07:00
committed by GitHub
parent 7ad18f717a
commit efb5a2e7f1
2 changed files with 11 additions and 12 deletions

View File

@@ -434,13 +434,13 @@ suite('Keyboard Shortcut Items', function () {
});
});
});
// Do not undo if a gesture is in progress.
suite('Gesture in progress', function () {
// Do not undo if a drag is in progress.
suite('Drag in progress', function () {
testCases.forEach(function (testCase) {
const testCaseName = testCase[0];
const keyEvent = testCase[1];
test(testCaseName, function () {
sinon.stub(Blockly.Gesture, 'inProgress').returns(true);
sinon.stub(this.workspace, 'isDragging').returns(true);
this.injectionDiv.dispatchEvent(keyEvent);
sinon.assert.notCalled(this.undoSpy);
sinon.assert.notCalled(this.hideChaffSpy);
@@ -494,13 +494,13 @@ suite('Keyboard Shortcut Items', function () {
});
});
});
// Do not undo if a gesture is in progress.
suite('Gesture in progress', function () {
// Do not redo if a drag is in progress.
suite('Drag in progress', function () {
testCases.forEach(function (testCase) {
const testCaseName = testCase[0];
const keyEvent = testCase[1];
test(testCaseName, function () {
sinon.stub(Blockly.Gesture, 'inProgress').returns(true);
sinon.stub(this.workspace, 'isDragging').returns(true);
this.injectionDiv.dispatchEvent(keyEvent);
sinon.assert.notCalled(this.redoSpy);
sinon.assert.notCalled(this.hideChaffSpy);
@@ -534,8 +534,8 @@ suite('Keyboard Shortcut Items', function () {
sinon.assert.calledWith(this.undoSpy, true);
sinon.assert.calledOnce(this.hideChaffSpy);
});
test('Not called when a gesture is in progress', function () {
sinon.stub(Blockly.Gesture, 'inProgress').returns(true);
test('Not called when a drag is in progress', function () {
sinon.stub(this.workspace, 'isDragging').returns(true);
this.injectionDiv.dispatchEvent(this.ctrlYEvent);
sinon.assert.notCalled(this.undoSpy);
sinon.assert.notCalled(this.hideChaffSpy);