From 63c3480ef4916381ef5bde9b2611c8ccae93c266 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Thu, 21 Apr 2011 15:57:19 +0200 Subject: [PATCH] Add item tests for moving items across documents and selecting groups. --- test/tests/item.js | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/test/tests/item.js b/test/tests/item.js index 351618eb..9d29ce03 100644 --- a/test/tests/item.js +++ b/test/tests/item.js @@ -147,4 +147,39 @@ test('reverseChildren()', function() { equals(doc.activeLayer.firstChild == path, false); equals(doc.activeLayer.firstChild == thirdPath, true); equals(doc.activeLayer.lastChild == path, true); -}) \ No newline at end of file +}); + +test('Check item#document when moving items across documents', function() { + var doc1 = new Document(); + var path = new Path(); + var group = new Group(); + group.appendTop(new Path()); + + equals(path.document == doc1, true); + var doc2 = new Document(); + doc2.activeLayer.appendTop(path); + equals(path.document == doc2, true); + + doc2.activeLayer.appendTop(group); + equals(group.children[0].document == doc2, true); +}); + +test('group.selected', function() { + var doc = new Document(); + var path = new Path(); + var path2 = new Path(); + var group = new Group([path, path2]); + path.selected = true; + equals(group.selected, true); + + path.selected = false; + equals(group.selected, false); + + group.selected = true; + equals(path.selected, true); + equals(path2.selected, true); + + group.selected = false; + equals(path.selected, false); + equals(path2.selected, false); +}); \ No newline at end of file