瀏覽代碼

Fixed tests for Node and NodeList.

Szymon Cofalik 10 年之前
父節點
當前提交
036c761e2b
共有 2 個文件被更改,包括 219 次插入253 次删除
  1. 134 160
      packages/ckeditor5-utils/tests/document/node.js
  2. 85 93
      packages/ckeditor5-utils/tests/document/nodelist.js

+ 134 - 160
packages/ckeditor5-utils/tests/document/node.js

@@ -13,8 +13,8 @@ var modules = bender.amd.require(
 	'document/attribute',
 	'document/nodelist' );
 
-describe( 'tree', function() {
-	var Element, Character;
+describe( 'Node', function() {
+	var Element, Character, Attribute, NodeList;
 
 	var root;
 	var one, two, three;
@@ -23,6 +23,8 @@ describe( 'tree', function() {
 	before( function() {
 		Element = modules[ 'document/element' ];
 		Character = modules[ 'document/character' ];
+		Attribute = modules[ 'document/attribute' ];
+		NodeList = modules[ 'document/nodelist' ];
 
 		charB = new Character( 'b' );
 		charA = new Character( 'a' );
@@ -36,209 +38,181 @@ describe( 'tree', function() {
 		root = new Element( null, null, [ one, two, three ] );
 	} );
 
-	it( 'should have proper positionInParent', function() {
-		expect( root ).to.have.property( 'positionInParent' ).that.is.null;
+	describe( 'should have a correct property', function() {
+		it( 'positionInParent', function() {
+			expect( root ).to.have.property( 'positionInParent' ).that.is.null;
 
-		expect( one ).to.have.property( 'positionInParent' ).that.equals( 0 );
-		expect( two ).to.have.property( 'positionInParent' ).that.equals( 1 );
-		expect( three ).to.have.property( 'positionInParent' ).that.equals( 2 );
+			expect( one ).to.have.property( 'positionInParent' ).that.equals( 0 );
+			expect( two ).to.have.property( 'positionInParent' ).that.equals( 1 );
+			expect( three ).to.have.property( 'positionInParent' ).that.equals( 2 );
 
-		expect( charB ).to.have.property( 'positionInParent' ).that.equals( 0 );
-		expect( charA ).to.have.property( 'positionInParent' ).that.equals( 1 );
-		expect( img ).to.have.property( 'positionInParent' ).that.equals( 2 );
-		expect( charR ).to.have.property( 'positionInParent' ).that.equals( 3 );
-	} );
+			expect( charB ).to.have.property( 'positionInParent' ).that.equals( 0 );
+			expect( charA ).to.have.property( 'positionInParent' ).that.equals( 1 );
+			expect( img ).to.have.property( 'positionInParent' ).that.equals( 2 );
+			expect( charR ).to.have.property( 'positionInParent' ).that.equals( 3 );
+		} );
 
-	it( 'should have proper depth', function() {
-		expect( root ).to.have.property( 'depth' ).that.equals( 0 );
+		it( 'depth', function() {
+			expect( root ).to.have.property( 'depth' ).that.equals( 0 );
 
-		expect( one ).to.have.property( 'depth' ).that.equals( 1 );
-		expect( two ).to.have.property( 'depth' ).that.equals( 1 );
-		expect( three ).to.have.property( 'depth' ).that.equals( 1 );
+			expect( one ).to.have.property( 'depth' ).that.equals( 1 );
+			expect( two ).to.have.property( 'depth' ).that.equals( 1 );
+			expect( three ).to.have.property( 'depth' ).that.equals( 1 );
 
-		expect( charB ).to.have.property( 'depth' ).that.equals( 2 );
-		expect( charA ).to.have.property( 'depth' ).that.equals( 2 );
-		expect( img ).to.have.property( 'depth' ).that.equals( 2 );
-		expect( charR ).to.have.property( 'depth' ).that.equals( 2 );
-	} );
+			expect( charB ).to.have.property( 'depth' ).that.equals( 2 );
+			expect( charA ).to.have.property( 'depth' ).that.equals( 2 );
+			expect( img ).to.have.property( 'depth' ).that.equals( 2 );
+			expect( charR ).to.have.property( 'depth' ).that.equals( 2 );
+		} );
 
-	it( 'should have proper root', function() {
-		expect( root ).to.have.property( 'root' ).that.equals( root );
+		it( 'root', function() {
+			expect( root ).to.have.property( 'root' ).that.equals( root );
 
-		expect( one ).to.have.property( 'root' ).that.equals( root );
-		expect( two ).to.have.property( 'root' ).that.equals( root );
-		expect( three ).to.have.property( 'root' ).that.equals( root );
+			expect( one ).to.have.property( 'root' ).that.equals( root );
+			expect( two ).to.have.property( 'root' ).that.equals( root );
+			expect( three ).to.have.property( 'root' ).that.equals( root );
 
-		expect( charB ).to.have.property( 'root' ).that.equals( root );
-		expect( charA ).to.have.property( 'root' ).that.equals( root );
-		expect( img ).to.have.property( 'root' ).that.equals( root );
-		expect( charR ).to.have.property( 'root' ).that.equals( root );
-	} );
+			expect( charB ).to.have.property( 'root' ).that.equals( root );
+			expect( charA ).to.have.property( 'root' ).that.equals( root );
+			expect( img ).to.have.property( 'root' ).that.equals( root );
+			expect( charR ).to.have.property( 'root' ).that.equals( root );
+		} );
 
-	it( 'should have proper nextSibling', function() {
-		expect( root ).to.have.property( 'nextSibling' ).that.is.null;
+		it( 'nextSibling', function() {
+			expect( root ).to.have.property( 'nextSibling' ).that.is.null;
 
-		expect( one ).to.have.property( 'nextSibling' ).that.equals( two );
-		expect( two ).to.have.property( 'nextSibling' ).that.equals( three );
-		expect( three ).to.have.property( 'nextSibling' ).that.is.null;
+			expect( one ).to.have.property( 'nextSibling' ).that.equals( two );
+			expect( two ).to.have.property( 'nextSibling' ).that.equals( three );
+			expect( three ).to.have.property( 'nextSibling' ).that.is.null;
 
-		expect( charB ).to.have.property( 'nextSibling' ).that.equals( charA );
-		expect( charA ).to.have.property( 'nextSibling' ).that.equals( img );
-		expect( img ).to.have.property( 'nextSibling' ).that.equals( charR );
-		expect( charR ).to.have.property( 'nextSibling' ).that.is.null;
-	} );
+			expect( charB ).to.have.property( 'nextSibling' ).that.equals( charA );
+			expect( charA ).to.have.property( 'nextSibling' ).that.equals( img );
+			expect( img ).to.have.property( 'nextSibling' ).that.equals( charR );
+			expect( charR ).to.have.property( 'nextSibling' ).that.is.null;
+		} );
 
-	it( 'should have proper previousSibling', function() {
-		expect( root ).to.have.property( 'previousSibling' ).that.is.expect;
+		it( 'previousSibling', function() {
+			expect( root ).to.have.property( 'previousSibling' ).that.is.expect;
 
-		expect( one ).to.have.property( 'previousSibling' ).that.is.null;
-		expect( two ).to.have.property( 'previousSibling' ).that.equals( one );
-		expect( three ).to.have.property( 'previousSibling' ).that.equals( two );
+			expect( one ).to.have.property( 'previousSibling' ).that.is.null;
+			expect( two ).to.have.property( 'previousSibling' ).that.equals( one );
+			expect( three ).to.have.property( 'previousSibling' ).that.equals( two );
 
-		expect( charB ).to.have.property( 'previousSibling' ).that.is.null;
-		expect( charA ).to.have.property( 'previousSibling' ).that.equals( charB );
-		expect( img ).to.have.property( 'previousSibling' ).that.equals( charA );
-		expect( charR ).to.have.property( 'previousSibling' ).that.equals( img );
+			expect( charB ).to.have.property( 'previousSibling' ).that.is.null;
+			expect( charA ).to.have.property( 'previousSibling' ).that.equals( charB );
+			expect( img ).to.have.property( 'previousSibling' ).that.equals( charA );
+			expect( charR ).to.have.property( 'previousSibling' ).that.equals( img );
+		} );
 	} );
-} );
-
-describe( 'constructor', function() {
-	it( 'should copy attributes, not pass by reference', function() {
-		var Element = modules[ 'document/element' ];
-		var Attribute = modules[ 'document/attribute' ];
 
-		var attrs = [ new Attribute( 'attr', true ) ];
-		var foo = new Element( 'foo', attrs );
-		var bar = new Element( 'bar', attrs );
+	describe( 'constructor', function() {
+		it( 'should copy attributes, not pass by reference', function() {
+			var attrs = [ new Attribute( 'attr', true ) ];
+			var foo = new Element( 'foo', attrs );
+			var bar = new Element( 'bar', attrs );
 
-		foo.removeAttr( 'attr' );
+			foo.removeAttr( 'attr' );
 
-		expect( foo._getAttrCount() ).to.equal( 0 );
-		expect( bar._getAttrCount() ).to.equal( 1 );
+			expect( foo._getAttrCount() ).to.equal( 0 );
+			expect( bar._getAttrCount() ).to.equal( 1 );
+		} );
 	} );
-} );
-
-describe( 'getAttr', function() {
-	it( 'should be possible to get attribute by key', function() {
-		var Element = modules[ 'document/element' ];
-		var Attribute = modules[ 'document/attribute' ];
 
-		var fooAttr = new Attribute( 'foo', true );
-		var element = new Element( 'foo', [ fooAttr ] );
+	describe( 'getAttr', function() {
+		var fooAttr, element;
 
-		expect( element.getAttr( 'foo' ) ).to.equal( fooAttr.value );
-	} );
+		beforeEach( function() {
+			fooAttr = new Attribute( 'foo', true );
+			element = new Element( 'foo', [ fooAttr ] );
+		} );
 
-	it( 'should return null if attribute was not found by key', function() {
-		var Element = modules[ 'document/element' ];
-		var Attribute = modules[ 'document/attribute' ];
+		it( 'should be possible to get attribute by key', function() {
+			expect( element.getAttr( 'foo' ) ).to.equal( fooAttr.value );
+		} );
 
-		var fooAttr = new Attribute( 'foo', true );
-		var element = new Element( 'foo', [ fooAttr ] );
-
-		expect( element.getAttr( 'bar' ) ).to.be.null;
+		it( 'should return null if attribute was not found by key', function() {
+			expect( element.getAttr( 'bar' ) ).to.be.null;
+		} );
 	} );
-} );
 
-describe( 'setAttr', function() {
-	it( 'should insert an attribute', function() {
-		var Element = modules[ 'document/element' ];
-		var Attribute = modules[ 'document/attribute' ];
+	describe( 'setAttr', function() {
+		it( 'should insert an attribute', function() {
+			var element = new Element( 'elem' );
+			var attr = new Attribute( 'foo', 'bar' );
 
-		var element = new Element( 'elem' );
-		var attr = new Attribute( 'foo', 'bar' );
-		element.setAttr( attr );
+			element.setAttr( attr );
 
-		expect( element._getAttrCount() ).to.equal( 1 );
-		expect( element.getAttr( attr.key ) ).to.equal( attr.value );
-	} );
-
-	it( 'should overwrite attribute with the same key', function() {
-		var Element = modules[ 'document/element' ];
-		var Attribute = modules[ 'document/attribute' ];
-
-		var oldAttr = new Attribute( 'foo', 'bar' );
-		var newAttr = new Attribute( 'foo', 'bar' );
-		var element = new Element( 'elem', [ oldAttr ] );
+			expect( element._getAttrCount() ).to.equal( 1 );
+			expect( element.getAttr( attr.key ) ).to.equal( attr.value );
+		} );
 
-		element.setAttr( newAttr );
+		it( 'should overwrite attribute with the same key', function() {
+			var oldAttr = new Attribute( 'foo', 'bar' );
+			var newAttr = new Attribute( 'foo', 'bar' );
+			var element = new Element( 'elem', [ oldAttr ] );
 
-		expect( element._getAttrCount() ).to.equal( 1 );
-		expect( element.getAttr( newAttr.key ) ).to.equal( newAttr.value );
-	} );
-} );
+			element.setAttr( newAttr );
 
-describe( 'removeAttr', function() {
-	it( 'should remove an attribute', function() {
-		var Element = modules[ 'document/element' ];
-		var Attribute = modules[ 'document/attribute' ];
-
-		var attrA = new Attribute( 'a', 'A' );
-		var attrB = new Attribute( 'b', 'b' );
-		var attrC = new Attribute( 'c', 'C' );
-		var element = new Element( 'elem', [ attrA, attrB, attrC ] );
-		element.removeAttr( attrB.key );
-
-		expect( element._getAttrCount() ).to.equal( 2 );
-		expect( element.getAttr( attrA.key ) ).to.equal( attrA.value );
-		expect( element.getAttr( attrC.key ) ).to.equal( attrC.value );
-		expect( element.getAttr( attrB.key ) ).to.be.null;
+			expect( element._getAttrCount() ).to.equal( 1 );
+			expect( element.getAttr( newAttr.key ) ).to.equal( newAttr.value );
+		} );
 	} );
-} );
 
-describe( 'hasAttr', function() {
-	it( 'should check attribute by key', function() {
-		var Element = modules[ 'document/element' ];
-		var Attribute = modules[ 'document/attribute' ];
+	describe( 'removeAttr', function() {
+		it( 'should remove an attribute', function() {
+			var attrA = new Attribute( 'a', 'A' );
+			var attrB = new Attribute( 'b', 'b' );
+			var attrC = new Attribute( 'c', 'C' );
+			var element = new Element( 'elem', [ attrA, attrB, attrC ] );
 
-		var fooAttr = new Attribute( 'foo', true );
-		var element = new Element( 'foo', [ fooAttr ] );
+			element.removeAttr( attrB.key );
 
-		expect( element.hasAttr( 'foo' ) ).to.be.true;
+			expect( element._getAttrCount() ).to.equal( 2 );
+			expect( element.getAttr( attrA.key ) ).to.equal( attrA.value );
+			expect( element.getAttr( attrC.key ) ).to.equal( attrC.value );
+			expect( element.getAttr( attrB.key ) ).to.be.null;
+		} );
 	} );
 
-	it( 'should return false if attribute was not found by key', function() {
-		var Element = modules[ 'document/element' ];
-		var Attribute = modules[ 'document/attribute' ];
+	describe( 'hasAttr', function() {
+		it( 'should check attribute by key', function() {
+			var fooAttr = new Attribute( 'foo', true );
+			var element = new Element( 'foo', [ fooAttr ] );
 
-		var fooAttr = new Attribute( 'foo', true );
-		var element = new Element( 'foo', [ fooAttr ] );
+			expect( element.hasAttr( 'foo' ) ).to.be.true;
+		} );
 
-		expect( element.hasAttr( 'bar' ) ).to.be.false;
-	} );
-
-	it( 'should check attribute by object', function() {
-		var Element = modules[ 'document/element' ];
-		var Attribute = modules[ 'document/attribute' ];
+		it( 'should return false if attribute was not found by key', function() {
+			var fooAttr = new Attribute( 'foo', true );
+			var element = new Element( 'foo', [ fooAttr ] );
 
-		var fooAttr = new Attribute( 'foo', true );
-		var foo2Attr = new Attribute( 'foo', true );
-		var element = new Element( 'foo', [ fooAttr ] );
+			expect( element.hasAttr( 'bar' ) ).to.be.false;
+		} );
 
-		expect( element.hasAttr( foo2Attr ) ).to.be.true;
-	} );
+		it( 'should check attribute by object', function() {
+			var fooAttr = new Attribute( 'foo', true );
+			var foo2Attr = new Attribute( 'foo', true );
+			var element = new Element( 'foo', [ fooAttr ] );
 
-	it( 'should return false if attribute was not found by object', function() {
-		var Element = modules[ 'document/element' ];
-		var Attribute = modules[ 'document/attribute' ];
+			expect( element.hasAttr( foo2Attr ) ).to.be.true;
+		} );
 
-		var fooAttr = new Attribute( 'foo', true );
-		var element = new Element( 'foo' );
-
-		expect( element.hasAttr( fooAttr ) ).to.be.false;
-	} );
+		it( 'should return false if attribute was not found by object', function() {
+			var fooAttr = new Attribute( 'foo', true );
+			var element = new Element( 'foo' );
 
-	it( 'should create proper JSON string using toJSON method', function() {
-		var Element = modules[ 'document/element' ];
-		var Character = modules[ 'document/character' ];
+			expect( element.hasAttr( fooAttr ) ).to.be.false;
+		} );
 
-		var b = new Character( 'b' );
-		var foo = new Element( 'foo', [], [ b ] );
+		it( 'should create proper JSON string using toJSON method', function() {
+			var b = new Character( 'b' );
+			var foo = new Element( 'foo', [], [ b ] );
 
-		var parsedFoo = JSON.parse( JSON.stringify( foo ) );
-		var parsedBar = JSON.parse( JSON.stringify( b ) );
+			var parsedFoo = JSON.parse( JSON.stringify( foo ) );
+			var parsedBar = JSON.parse( JSON.stringify( b ) );
 
-		expect( parsedFoo.parent ).to.equal( null );
-		expect( parsedBar.parent ).to.equal( 'foo' );
+			expect( parsedFoo.parent ).to.equal( null );
+			expect( parsedBar.parent ).to.equal( 'foo' );
+		} );
 	} );
 } );

+ 85 - 93
packages/ckeditor5-utils/tests/document/nodelist.js

@@ -13,110 +13,102 @@ var modules = bender.amd.require(
 	'document/text',
 	'document/attribute' );
 
-describe( 'constructor', function() {
-	it( 'should change array of strings into a set of nodes', function() {
-		var NodeList = modules[ 'document/nodelist' ];
-		var Character = modules[ 'document/character' ];
-
-		var nodeList = new NodeList( [ 'foo', new Character( 'x' ), 'bar' ] );
-
-		expect( nodeList.length ).to.equal( 7 );
-		expect( nodeList.get( 0 ).character ).to.equal( 'f' );
-		expect( nodeList.get( 1 ).character ).to.equal( 'o' );
-		expect( nodeList.get( 2 ).character ).to.equal( 'o' );
-		expect( nodeList.get( 3 ).character ).to.equal( 'x' );
-		expect( nodeList.get( 4 ).character ).to.equal( 'b' );
-		expect( nodeList.get( 5 ).character ).to.equal( 'a' );
-		expect( nodeList.get( 6 ).character ).to.equal( 'r' );
+describe( 'NodeList', function() {
+	var NodeList, Character, Text, Attribute;
+
+	before( function() {
+		NodeList = modules[ 'document/nodelist' ];
+		Character = modules[ 'document/character' ];
+		Text = modules[ 'document/text' ];
+		Attribute = modules[ 'document/attribute' ];
 	} );
 
-	it( 'should change string into a set of nodes', function() {
-		var NodeList = modules[ 'document/nodelist' ];
-
-		var nodeList = new NodeList( 'foo' );
-
-		expect( nodeList.length ).to.equal( 3 );
-		expect( nodeList.get( 0 ).character ).to.equal( 'f' );
-		expect( nodeList.get( 1 ).character ).to.equal( 'o' );
-		expect( nodeList.get( 2 ).character ).to.equal( 'o' );
+	describe( 'constructor', function() {
+		it( 'should change array of strings into a set of nodes', function() {
+			var nodeList = new NodeList( [ 'foo', new Character( 'x' ), 'bar' ] );
+
+			expect( nodeList.length ).to.equal( 7 );
+			expect( nodeList.get( 0 ).character ).to.equal( 'f' );
+			expect( nodeList.get( 1 ).character ).to.equal( 'o' );
+			expect( nodeList.get( 2 ).character ).to.equal( 'o' );
+			expect( nodeList.get( 3 ).character ).to.equal( 'x' );
+			expect( nodeList.get( 4 ).character ).to.equal( 'b' );
+			expect( nodeList.get( 5 ).character ).to.equal( 'a' );
+			expect( nodeList.get( 6 ).character ).to.equal( 'r' );
+		} );
+
+		it( 'should change string into a set of nodes', function() {
+			var nodeList = new NodeList( 'foo' );
+
+			expect( nodeList.length ).to.equal( 3 );
+			expect( nodeList.get( 0 ).character ).to.equal( 'f' );
+			expect( nodeList.get( 1 ).character ).to.equal( 'o' );
+			expect( nodeList.get( 2 ).character ).to.equal( 'o' );
+		} );
+
+		it( 'should change node into a set of nodes', function() {
+			var nodeList = new NodeList( new Character( 'x' ) );
+
+			expect( nodeList.length ).to.equal( 1 );
+			expect( nodeList.get( 0 ).character ).to.equal( 'x' );
+		} );
+
+		it( 'should change text with attribute into a set of nodes', function() {
+			var attr = new Attribute( 'bold', true );
+			var nodeList = new NodeList( new Text( 'foo', [ attr ] ) );
+
+			expect( nodeList.length ).to.equal( 3 );
+			expect( nodeList.get( 0 ).character ).to.equal( 'f' );
+			expect( nodeList.get( 0 ).getAttr( attr.key ) ).to.equal( attr.value );
+			expect( nodeList.get( 1 ).character ).to.equal( 'o' );
+			expect( nodeList.get( 1 ).getAttr( attr.key ) ).to.equal( attr.value );
+			expect( nodeList.get( 2 ).character ).to.equal( 'o' );
+			expect( nodeList.get( 2 ).getAttr( attr.key ) ).to.equal( attr.value );
+		} );
 	} );
 
-	it( 'should change node into a set of nodes', function() {
-		var NodeList = modules[ 'document/nodelist' ];
-		var Character = modules[ 'document/character' ];
-
-		var nodeList = new NodeList( new Character( 'x' ) );
-
-		expect( nodeList.length ).to.equal( 1 );
-		expect( nodeList.get( 0 ).character ).to.equal( 'x' );
+	describe( 'insert', function() {
+		it( 'should insert one nodelist into another', function() {
+			var outerList = new NodeList( 'foo' );
+			var innerList = new NodeList( 'xxx' );
+
+			outerList.insert( 2, innerList );
+
+			expect( outerList.length ).to.equal( 6 );
+			expect( outerList.get( 0 ).character ).to.equal( 'f' );
+			expect( outerList.get( 1 ).character ).to.equal( 'o' );
+			expect( outerList.get( 2 ).character ).to.equal( 'x' );
+			expect( outerList.get( 3 ).character ).to.equal( 'x' );
+			expect( outerList.get( 4 ).character ).to.equal( 'x' );
+			expect( outerList.get( 5 ).character ).to.equal( 'o' );
+		} );
 	} );
 
-	it( 'should change text with attribute into a set of nodes', function() {
-		var NodeList = modules[ 'document/nodelist' ];
-		var Text = modules[ 'document/text' ];
-		var Attribute = modules[ 'document/attribute' ];
-
-		var attr = new Attribute( 'bold', true );
+	describe( 'remove', function() {
+		it( 'should remove part of the nodelist', function() {
+			var nodeList = new NodeList( 'foobar' );
 
-		var nodeList = new NodeList( new Text( 'foo', [ attr ] ) );
+			nodeList.remove( 2, 3 );
 
-		expect( nodeList.length ).to.equal( 3 );
-		expect( nodeList.get( 0 ).character ).to.equal( 'f' );
-		expect( nodeList.get( 0 ).getAttr( attr.key ) ).to.equal( attr.value );
-		expect( nodeList.get( 1 ).character ).to.equal( 'o' );
-		expect( nodeList.get( 1 ).getAttr( attr.key ) ).to.equal( attr.value );
-		expect( nodeList.get( 2 ).character ).to.equal( 'o' );
-		expect( nodeList.get( 2 ).getAttr( attr.key ) ).to.equal( attr.value );
+			expect( nodeList.length ).to.equal( 3 );
+			expect( nodeList.get( 0 ).character ).to.equal( 'f' );
+			expect( nodeList.get( 1 ).character ).to.equal( 'o' );
+			expect( nodeList.get( 2 ).character ).to.equal( 'r' );
+		} );
 	} );
-} );
-
-describe( 'insert', function() {
-	it( 'should insert one nodelist into another', function() {
-		var NodeList = modules[ 'document/nodelist' ];
-
-		var outerList = new NodeList( 'foo' );
-		var innerList = new NodeList( 'xxx' );
-
-		outerList.insert( 2, innerList );
-
-		expect( outerList.length ).to.equal( 6 );
-		expect( outerList.get( 0 ).character ).to.equal( 'f' );
-		expect( outerList.get( 1 ).character ).to.equal( 'o' );
-		expect( outerList.get( 2 ).character ).to.equal( 'x' );
-		expect( outerList.get( 3 ).character ).to.equal( 'x' );
-		expect( outerList.get( 4 ).character ).to.equal( 'x' );
-		expect( outerList.get( 5 ).character ).to.equal( 'o' );
-	} );
-} );
-
-describe( 'remove', function() {
-	it( 'should remove part of the nodelist', function() {
-		var NodeList = modules[ 'document/nodelist' ];
-
-		var nodeList = new NodeList( 'foobar' );
-
-		nodeList.remove( 2, 3 );
-
-		expect( nodeList.length ).to.equal( 3 );
-		expect( nodeList.get( 0 ).character ).to.equal( 'f' );
-		expect( nodeList.get( 1 ).character ).to.equal( 'o' );
-		expect( nodeList.get( 2 ).character ).to.equal( 'r' );
-	} );
-} );
-
-describe( 'iterator', function() {
-	it( 'should iterate over all elements in the collection', function() {
-		var NodeList = modules[ 'document/nodelist' ];
 
-		var characters = 'foo';
-		var nodeList = new NodeList( characters );
-		var i = 0;
+	describe( 'iterator', function() {
+		it( 'should iterate over all elements in the collection', function() {
+			var characters = 'foo';
+			var nodeList = new NodeList( characters );
+			var i = 0;
 
-		for ( var node of nodeList ) {
-			expect( node.character ).to.equal( characters[ i ] );
-			i++;
-		}
+			for ( var node of nodeList ) {
+				expect( node.character ).to.equal( characters[ i ] );
+				i++;
+			}
 
-		expect( i ).to.equal( 3 );
+			expect( i ).to.equal( 3 );
+		} );
 	} );
 } );