Skip to content

Commit

Permalink
chore: add tests for bumping pasted comments
Browse files Browse the repository at this point in the history
  • Loading branch information
BeksOmega committed Aug 2, 2023
1 parent 940bb59 commit 2ab0458
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/mocha/clipboard_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,23 @@ suite('Clipboard', function () {
});
});
});

suite('pasting comments', function () {
test('pasted comments are bumped to not overlap', function () {
Blockly.Xml.domToWorkspace(
Blockly.utils.xml.textToDom(
'<xml><comment id="test" x=10 y=10/></xml>',
),
this.workspace
);
const comment = this.workspace.getTopComments(false)[0];
const data = comment.toCopyData();

const newComment = Blockly.clipboard.paste(data, this.workspace);
chai.assert.deepEqual(
newComment.getRelativeToSurfaceXY(),
new Blockly.utils.Coordinate(60, 60),
);
});
});
});

0 comments on commit 2ab0458

Please sign in to comment.