Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions src/actions/mover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ export class Mover {
const info = this.moves.get(workspace);
if (!info) throw new Error('no move info for workspace');

if (info.draggable instanceof comments.RenderedWorkspaceComment) {
return this.moveUnconstrained(workspace, direction);
}

info.dragger.onDrag(
info.fakePointerEvent('pointermove', direction),
info.totalDelta.clone().scale(workspace.scale),
Expand Down
17 changes: 16 additions & 1 deletion test/webdriverio/test/workspace_comment_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ suite('Workspace comment navigation', function () {
);
});

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

const initialPosition = await this.getCommentLocation(this.commentId1);
Expand All @@ -203,4 +203,19 @@ suite('Workspace comment navigation', function () {
const newPosition = await this.getCommentLocation(this.commentId1);
chai.assert.deepEqual(newPosition, [220, 240]);
});

test('Workspace comments can be moved in constrained mode', async function () {
await focusOnWorkspaceComment(this.browser, this.commentId1);

const initialPosition = await this.getCommentLocation(this.commentId1);
chai.assert.deepEqual(initialPosition, [200, 200]);

await sendKeyAndWait(this.browser, 'm');
await sendKeyAndWait(this.browser, Key.ArrowUp, 2);
await sendKeyAndWait(this.browser, Key.ArrowLeft);
await sendKeyAndWait(this.browser, Key.Enter);

const newPosition = await this.getCommentLocation(this.commentId1);
chai.assert.deepEqual(newPosition, [180, 160]);
});
});