Skip to content

Commit

Permalink
test(target/sprites): ensuring duplicated sprites have the same comme…
Browse files Browse the repository at this point in the history
…nt as the original
  • Loading branch information
John-Crawshaw authored Dec 7, 2024
1 parent dbbda79 commit 2080ee3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/unit/sprites_rendered-target.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,29 @@ test('blocks get new id on duplicate', t => {
});
});

test('comments are duplicated when duplicating target', t => {
const r = new Runtime();
const s = new Sprite(null, r);
const rt = new RenderedTarget(s, r);
rt.createComment('testCommentId', null, 'testcomment', 0, 0, 100, 100, false);
return rt.duplicate().then(duplicate => {
// ensure duplicated comment exists
t.equal(Object.keys(duplicate.comments).length, 1);

// ensure comment was duplicated correctly
const dupComment = duplicate.comments.testCommentId;
t.equal(dupComment.id, 'testCommentId');
t.equal(dupComment.text, 'testcomment');
t.equal(dupComment.x, 0);
t.equal(dupComment.y, 0);
t.equal(dupComment.width, 100);
t.equal(dupComment.height, 100);
t.equal(dupComment.minimized, false);

t.end();
});
});

test('direction', t => {
const r = new Runtime();
const s = new Sprite(null, r);
Expand Down

0 comments on commit 2080ee3

Please sign in to comment.