11module ( 'Item' ) ;
22
33test ( 'copyTo(document)' , function ( ) {
4- var doc = new Document ( ) ;
4+ var doc = paper . document ;
55 var path = new Path ( ) ;
66 var secondDoc = new Document ( ) ;
77 var copy = path . copyTo ( secondDoc ) ;
@@ -17,7 +17,7 @@ test('copyTo(document)', function() {
1717} ) ;
1818
1919test ( 'copyTo(layer)' , function ( ) {
20- var doc = new Document ( ) ;
20+ var doc = paper . document ;
2121 var path = new Path ( ) ;
2222
2323 var layer = new Layer ( ) ;
@@ -31,19 +31,19 @@ test('copyTo(layer)', function() {
3131} ) ;
3232
3333test ( 'clone()' , function ( ) {
34- var doc = new Document ( ) ;
34+ var doc = paper . document ;
3535 var path = new Path ( ) ;
3636 var copy = path . clone ( ) ;
3737 equals ( function ( ) {
38- return doc . activeLayer . children . length == 2 ;
39- } , true ) ;
38+ return doc . activeLayer . children . length ;
39+ } , 2 ) ;
4040 equals ( function ( ) {
4141 return path != copy ;
4242 } , true ) ;
4343} ) ;
4444
4545test ( 'appendChild(item)' , function ( ) {
46- var doc = new Document ( ) ;
46+ var doc = paper . document ;
4747 var path = new Path ( ) ;
4848 doc . activeLayer . appendChild ( path ) ;
4949 equals ( function ( ) {
@@ -52,7 +52,7 @@ test('appendChild(item)', function() {
5252} ) ;
5353
5454test ( 'item.parent / item.isChild / item.isParent' , function ( ) {
55- var doc = new Document ( ) ;
55+ var doc = paper . document ;
5656 var secondDoc = new Document ( ) ;
5757 var path = new Path ( ) ;
5858 doc . activeLayer . appendChild ( path ) ;
@@ -81,7 +81,7 @@ test('item.parent / item.isChild / item.isParent', function() {
8181} ) ;
8282
8383test ( 'item.lastChild / item.firstChild' , function ( ) {
84- var doc = new Document ( ) ;
84+ var doc = paper . document ;
8585 var path = new Path ( ) ;
8686 var secondPath = new Path ( ) ;
8787 equals ( function ( ) {
@@ -93,7 +93,7 @@ test('item.lastChild / item.firstChild', function() {
9393} ) ;
9494
9595test ( 'appendBottom(item)' , function ( ) {
96- var doc = new Document ( ) ;
96+ var doc = paper . document ;
9797 var path = new Path ( ) ;
9898 var secondPath = new Path ( ) ;
9999 doc . activeLayer . appendBottom ( secondPath ) ;
@@ -103,7 +103,7 @@ test('appendBottom(item)', function() {
103103} ) ;
104104
105105test ( 'moveAbove(item)' , function ( ) {
106- var doc = new Document ( ) ;
106+ var doc = paper . document ;
107107 var path = new Path ( ) ;
108108 var secondPath = new Path ( ) ;
109109 path . moveAbove ( secondPath ) ;
@@ -113,7 +113,7 @@ test('moveAbove(item)', function() {
113113} ) ;
114114
115115test ( 'moveBelow(item)' , function ( ) {
116- var doc = new Document ( ) ;
116+ var doc = paper . document ;
117117 var firstPath = new Path ( ) ;
118118 var secondPath = new Path ( ) ;
119119 equals ( function ( ) {
@@ -126,7 +126,7 @@ test('moveBelow(item)', function() {
126126} ) ;
127127
128128test ( 'isDescendant(item) / isAncestor(item)' , function ( ) {
129- var doc = new Document ( ) ;
129+ var doc = paper . document ;
130130 var path = new Path ( ) ;
131131 equals ( function ( ) {
132132 return path . isDescendant ( doc . activeLayer ) ;
@@ -152,7 +152,7 @@ test('isDescendant(item) / isAncestor(item)', function() {
152152} ) ;
153153
154154test ( 'isGroupedWith' , function ( ) {
155- var doc = new Document ( ) ;
155+ var doc = paper . document ;
156156 var path = new Path ( ) ;
157157 var secondPath = new Path ( ) ;
158158 var group = new Group ( [ path ] ) ;
@@ -191,7 +191,6 @@ test('isGroupedWith', function() {
191191} ) ;
192192
193193test ( 'getPreviousSibling() / getNextSibling()' , function ( ) {
194- var doc = new Document ( ) ;
195194 var firstPath = new Path ( ) ;
196195 var secondPath = new Path ( ) ;
197196 equals ( function ( ) {
@@ -206,7 +205,6 @@ test('getPreviousSibling() / getNextSibling()', function() {
206205} ) ;
207206
208207test ( 'hidden' , function ( ) {
209- var doc = new Document ( ) ;
210208 var firstPath = new Path ( ) ;
211209 firstPath . visible = false ;
212210 equals ( function ( ) {
@@ -215,7 +213,7 @@ test('hidden', function() {
215213} ) ;
216214
217215test ( 'reverseChildren()' , function ( ) {
218- var doc = new Document ( ) ;
216+ var doc = paper . document ;
219217 var path = new Path ( ) ;
220218 var secondPath = new Path ( ) ;
221219 var thirdPath = new Path ( ) ;
@@ -235,6 +233,7 @@ test('reverseChildren()', function() {
235233} ) ;
236234
237235test ( 'Check item#document when moving items across documents' , function ( ) {
236+ var doc = paper . document ;
238237 var doc1 = new Document ( ) ;
239238 var path = new Path ( ) ;
240239 var group = new Group ( ) ;
@@ -256,7 +255,6 @@ test('Check item#document when moving items across documents', function() {
256255} ) ;
257256
258257test ( 'group.selected' , function ( ) {
259- var doc = new Document ( ) ;
260258 var path = new Path ( [ 0 , 0 ] ) ;
261259 var path2 = new Path ( [ 0 , 0 ] ) ;
262260 var group = new Group ( [ path , path2 ] ) ;
0 commit comments