|
|
@@ -10,10 +10,6 @@
|
|
|
import Attribute from '/ckeditor5/core/treemodel/attribute.js';
|
|
|
|
|
|
describe( 'Attribute', () => {
|
|
|
- beforeEach( () => {
|
|
|
- Attribute._register = {};
|
|
|
- } );
|
|
|
-
|
|
|
describe( 'constructor', () => {
|
|
|
it( 'should create attribute', () => {
|
|
|
let attr = new Attribute( 'foo', 'bar' );
|
|
|
@@ -28,48 +24,5 @@ describe( 'Attribute', () => {
|
|
|
|
|
|
expect( attr1.isEqual( attr2 ) ).to.be.true;
|
|
|
} );
|
|
|
-
|
|
|
- it( 'should return the same object for registered objects', () => {
|
|
|
- Attribute.register( 'register', true );
|
|
|
-
|
|
|
- let attr1 = new Attribute( 'register', true );
|
|
|
- let attr2 = new Attribute( 'register', true );
|
|
|
-
|
|
|
- expect( attr1 ).to.equal( attr2 );
|
|
|
- expect( attr1.isEqual( attr2 ) ).to.be.true;
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'should return different objects for different values', () => {
|
|
|
- Attribute.register( 'register', true );
|
|
|
-
|
|
|
- let attr1 = new Attribute( 'register', true );
|
|
|
- let attr2 = new Attribute( 'register', false );
|
|
|
-
|
|
|
- expect( attr1 ).to.not.be.equals( attr2 );
|
|
|
- expect( attr1.isEqual( attr2 ) ).to.not.be.true;
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'should return different objects for not registered objects', () => {
|
|
|
- Attribute.register( 'register', true );
|
|
|
-
|
|
|
- let attr1 = new Attribute( 'register', false );
|
|
|
- let attr2 = new Attribute( 'register', false );
|
|
|
-
|
|
|
- expect( attr1 ).to.not.be.equals( attr2 );
|
|
|
- expect( attr1.isEqual( attr2 ) ).to.be.true;
|
|
|
- } );
|
|
|
- } );
|
|
|
-
|
|
|
- describe( 'register', () => {
|
|
|
- it( 'Attribute.register should return registered attribute', () => {
|
|
|
- let attr1 = new Attribute( 'register', true );
|
|
|
- let attr2 = Attribute.register( 'register', true );
|
|
|
- let attr3 = Attribute.register( 'register', true );
|
|
|
- let attr4 = new Attribute( 'register', true );
|
|
|
-
|
|
|
- expect( attr1 ).to.not.be.equals( attr2 );
|
|
|
- expect( attr2 ).to.equal( attr3 );
|
|
|
- expect( attr3 ).to.equal( attr4 );
|
|
|
- } );
|
|
|
} );
|
|
|
} );
|