Skip to content

Commit 61583ff

Browse files
authored
fix: add group when cutting workspace comments (#9680)
* fix: add group when cutting workspace comments * Update shortcut_items.ts * added check for group to the cut workspace comment unit test
1 parent 0bdae14 commit 61583ff

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

packages/blockly/core/shortcut_items.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ export function registerCut() {
217217
if (focused instanceof BlockSvg) {
218218
focused.checkAndDelete();
219219
} else if (isIDeletable(focused)) {
220+
eventUtils.setGroup(true);
220221
focused.dispose();
222+
eventUtils.setGroup(false);
221223
}
222224
return !!copyData;
223225
},

packages/blockly/tests/mocha/shortcut_items_test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,11 @@ suite('Keyboard Shortcut Items', function () {
295295
this.disposeSpy = sinon.spy(this.comment, 'dispose');
296296

297297
this.injectionDiv.dispatchEvent(keyEvent);
298+
299+
const deleteEvents = this.workspace
300+
.getUndoStack()
301+
.filter((e) => e.type === 'comment_delete');
302+
assert(deleteEvents[0].group !== ''); // Group string is not empty
298303
sinon.assert.calledOnce(this.copySpy);
299304
sinon.assert.calledOnce(this.disposeSpy);
300305
});

0 commit comments

Comments
 (0)