浏览代码

Tests: Unit test for empty style tag handling. Bring CC back to 100%.

Krzysztof Krztoń 7 年之前
父节点
当前提交
e2d1f87d1a
共有 1 个文件被更改,包括 14 次插入0 次删除
  1. 14 0
      packages/ckeditor5-paste-from-office/tests/filters/utils.js

+ 14 - 0
packages/ckeditor5-paste-from-office/tests/filters/utils.js

@@ -76,5 +76,19 @@ describe( 'Filters – utils', () => {
 
 
 			expect( stylesString ).to.equal( '' );
 			expect( stylesString ).to.equal( '' );
 		} );
 		} );
+
+		it( 'correctly parses HTML with body contents and empty style tag', () => {
+			const html = '<head><style></style></head><body><p>Foo Bar</p></body>';
+			const { body, bodyString, styles, stylesString } = parseHtml( html );
+
+			expect( body ).to.instanceof( DocumentFragment );
+			expect( body.childCount ).to.equal( 1 );
+
+			expect( bodyString ).to.equal( '<p>Foo Bar</p>' );
+
+			expect( styles.length ).to.equal( 0 );
+
+			expect( stylesString ).to.equal( '' );
+		} );
 	} );
 	} );
 } );
 } );