Skip to content

Commit 12664d6

Browse files
authored
fix: Allow workspace comments to be moved in constrained mode. (#646)
* fix: Allow workspace comments to be moved in constrained mode. * chore: Add test for moving workspace comments in constrained mode. * refactor: Use arrow wrapper functions in test.
1 parent 0d6acb8 commit 12664d6

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/actions/mover.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,10 @@ export class Mover {
318318
const info = this.moves.get(workspace);
319319
if (!info) throw new Error('no move info for workspace');
320320

321+
if (info.draggable instanceof comments.RenderedWorkspaceComment) {
322+
return this.moveUnconstrained(workspace, direction);
323+
}
324+
321325
info.dragger.onDrag(
322326
info.fakePointerEvent('pointermove', direction),
323327
info.totalDelta.clone().scale(workspace.scale),

test/webdriverio/test/workspace_comment_test.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ suite('Workspace comment navigation', function () {
189189
);
190190
});
191191

192-
test('Workspace comments can be moved', async function () {
192+
test('Workspace comments can be moved in unconstrained mode', async function () {
193193
await focusOnWorkspaceComment(this.browser, this.commentId1);
194194

195195
const initialPosition = await this.getCommentLocation(this.commentId1);
@@ -203,4 +203,19 @@ suite('Workspace comment navigation', function () {
203203
const newPosition = await this.getCommentLocation(this.commentId1);
204204
chai.assert.deepEqual(newPosition, [220, 240]);
205205
});
206+
207+
test('Workspace comments can be moved in constrained mode', async function () {
208+
await focusOnWorkspaceComment(this.browser, this.commentId1);
209+
210+
const initialPosition = await this.getCommentLocation(this.commentId1);
211+
chai.assert.deepEqual(initialPosition, [200, 200]);
212+
213+
await sendKeyAndWait(this.browser, 'm');
214+
await keyUp(this.browser, 2);
215+
await keyLeft(this.browser);
216+
await sendKeyAndWait(this.browser, Key.Enter);
217+
218+
const newPosition = await this.getCommentLocation(this.commentId1);
219+
chai.assert.deepEqual(newPosition, [180, 160]);
220+
});
206221
});

0 commit comments

Comments
 (0)