|
|
@@ -986,7 +986,22 @@ describe( 'Element', () => {
|
|
|
it( 'should return only name if no other attributes are present', () => {
|
|
|
const el = new Element( 'foo' );
|
|
|
|
|
|
- expect( el.getIdentity() ).to.equal( 'foo' );
|
|
|
+ expect( el.getIdentity() ).to.equal( 'foo|classes()|styles()|attributes()' );
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should return classes in sorted order', () => {
|
|
|
+ const el = new Element( 'fruit' );
|
|
|
+ el.addClass( 'banana', 'lemon', 'apple' );
|
|
|
+
|
|
|
+ expect( el.getIdentity() ).to.equal( 'fruit|classes(apple,banana,lemon)|styles()|attributes()' );
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should return styles in sorted order', () => {
|
|
|
+ const el = new Element( 'foo', {
|
|
|
+ style: 'border: 1px solid red; background-color: red'
|
|
|
+ } );
|
|
|
+
|
|
|
+ expect( el.getIdentity() ).to.equal( 'foo|classes()|styles(background-color=red,border=1px solid red)|attributes()' );
|
|
|
} );
|
|
|
|
|
|
it( 'should return attributes in sorted order', () => {
|
|
|
@@ -996,15 +1011,21 @@ describe( 'Element', () => {
|
|
|
b: 3
|
|
|
} );
|
|
|
|
|
|
- expect( el.getIdentity() ).to.equal( 'foo|a=1|b=3|d=4' );
|
|
|
+ expect( el.getIdentity() ).to.equal( 'foo|classes()|styles()|attributes(a=1,b=3,d=4)' );
|
|
|
} );
|
|
|
|
|
|
- it( 'should return styles in sorted order', () => {
|
|
|
- const el = new Element( 'foo', {
|
|
|
- style: 'border: 1px solid red; background-color: red'
|
|
|
+ it( 'should return classes, styles and attributes', () => {
|
|
|
+ const el = new Element( 'baz', {
|
|
|
+ foo: 'one',
|
|
|
+ bar: 'two',
|
|
|
+ style: 'text-align:center;border-radius:10px'
|
|
|
} );
|
|
|
|
|
|
- expect( el.getIdentity() ).to.equal( 'foo|background-color=red|border=1px solid red' );
|
|
|
+ el.addClass( 'three', 'two', 'one' );
|
|
|
+
|
|
|
+ expect( el.getIdentity() ).to.equal(
|
|
|
+ 'baz|classes(one,three,two)|styles(border-radius=10px,text-align=center)|attributes(bar=two,foo=one)'
|
|
|
+ );
|
|
|
} );
|
|
|
} );
|
|
|
} );
|