瀏覽代碼

Improved tests in treeView.Element to increase code coverage.

Szymon Kupś 9 年之前
父節點
當前提交
008dd3b277
共有 1 個文件被更改,包括 13 次插入0 次删除
  1. 13 0
      packages/ckeditor5-engine/tests/treeview/element.js

+ 13 - 0
packages/ckeditor5-engine/tests/treeview/element.js

@@ -161,13 +161,16 @@ describe( 'Element', () => {
 			const el1 = new ViewElement( 'p' );
 			const el1 = new ViewElement( 'p' );
 			const el2 = new ViewElement( 'p' );
 			const el2 = new ViewElement( 'p' );
 			const el3 = new ViewElement( 'p' );
 			const el3 = new ViewElement( 'p' );
+			const el4 = new ViewElement( 'p' );
 
 
 			el1.addClass( 'foo', 'bar' );
 			el1.addClass( 'foo', 'bar' );
 			el2.addClass( 'bar', 'foo' );
 			el2.addClass( 'bar', 'foo' );
 			el3.addClass( 'baz' );
 			el3.addClass( 'baz' );
+			el4.addClass( 'baz', 'bar' );
 
 
 			expect( el1.isSimilar( el2 ) ).to.be.true;
 			expect( el1.isSimilar( el2 ) ).to.be.true;
 			expect( el1.isSimilar( el3 ) ).to.be.false;
 			expect( el1.isSimilar( el3 ) ).to.be.false;
+			expect( el1.isSimilar( el4 ) ).to.be.false;
 		} );
 		} );
 	} );
 	} );
 
 
@@ -318,6 +321,16 @@ describe( 'Element', () => {
 				expect( el.getAttribute( 'foo' ) ).to.equal( 'bar' );
 				expect( el.getAttribute( 'foo' ) ).to.equal( 'bar' );
 				expect( el.getAttribute( 'bom' ) ).to.not.be.ok;
 				expect( el.getAttribute( 'bom' ) ).to.not.be.ok;
 			} );
 			} );
+
+			it( 'should return class attribute', () => {
+				el.addClass( 'foo', 'bar' );
+
+				expect( el.getAttribute( 'class' ) ).to.equal( 'foo bar' );
+			} );
+
+			it( 'should return undefined if no class attribute', () => {
+				expect( el.getAttribute( 'class' ) ).to.be.undefined;
+			} );
 		} );
 		} );
 
 
 		describe( 'hasAttribute', () => {
 		describe( 'hasAttribute', () => {