Skip to content

Commit 2080ee3

Browse files
test(target/sprites): ensuring duplicated sprites have the same comment as the original
1 parent dbbda79 commit 2080ee3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/unit/sprites_rendered-target.js

+23
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,29 @@ test('blocks get new id on duplicate', t => {
4545
});
4646
});
4747

48+
test('comments are duplicated when duplicating target', t => {
49+
const r = new Runtime();
50+
const s = new Sprite(null, r);
51+
const rt = new RenderedTarget(s, r);
52+
rt.createComment('testCommentId', null, 'testcomment', 0, 0, 100, 100, false);
53+
return rt.duplicate().then(duplicate => {
54+
// ensure duplicated comment exists
55+
t.equal(Object.keys(duplicate.comments).length, 1);
56+
57+
// ensure comment was duplicated correctly
58+
const dupComment = duplicate.comments.testCommentId;
59+
t.equal(dupComment.id, 'testCommentId');
60+
t.equal(dupComment.text, 'testcomment');
61+
t.equal(dupComment.x, 0);
62+
t.equal(dupComment.y, 0);
63+
t.equal(dupComment.width, 100);
64+
t.equal(dupComment.height, 100);
65+
t.equal(dupComment.minimized, false);
66+
67+
t.end();
68+
});
69+
});
70+
4871
test('direction', t => {
4972
const r = new Runtime();
5073
const s = new Sprite(null, r);

0 commit comments

Comments
 (0)