|
|
@@ -5,8 +5,12 @@
|
|
|
|
|
|
/* bender-tags: document */
|
|
|
|
|
|
+/* bender-include: ../_tools/tools.js */
|
|
|
+
|
|
|
'use strict';
|
|
|
|
|
|
+const getIteratorCount = bender.tools.core.getIteratorCount;
|
|
|
+
|
|
|
const modules = bender.amd.require(
|
|
|
'document/element',
|
|
|
'document/character',
|
|
|
@@ -206,6 +210,25 @@ describe( 'Node', () => {
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
+ describe( 'getAttrIterator', () => {
|
|
|
+ it( 'should allows to get attribute count', () => {
|
|
|
+ let element = new Element( 'foo', [
|
|
|
+ new Attribute( 1, true ),
|
|
|
+ new Attribute( 2, true ),
|
|
|
+ new Attribute( 3, true )
|
|
|
+ ] );
|
|
|
+
|
|
|
+ expect( getIteratorCount( element.getAttrIterator() ) ).to.equal( 3 );
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should allows to copy attributes', () => {
|
|
|
+ let element = new Element( 'foo', [ new Attribute( 'x', true ) ] );
|
|
|
+ let copy = new Element( 'bar', element.getAttrIterator() );
|
|
|
+
|
|
|
+ expect( copy.getAttr( 'x' ) ).to.be.true;
|
|
|
+ } );
|
|
|
+ } );
|
|
|
+
|
|
|
describe( 'getIndex', () => {
|
|
|
it( 'should return null if the parent is null', () => {
|
|
|
expect( root.getIndex() ).to.be.null;
|