浏览代码

Added additional view structure checking to ImageStyleEngine tests.

Szymon Kupś 8 年之前
父节点
当前提交
922f0dbb37
共有 1 个文件被更改,包括 26 次插入0 次删除
  1. 26 0
      packages/ckeditor5-image/tests/imagestyle/imagestyleengine.js

+ 26 - 0
packages/ckeditor5-image/tests/imagestyle/imagestyleengine.js

@@ -56,18 +56,26 @@ describe( 'ImageStyleEngine', () => {
 		editor.setData( '<figure class="image side-class"><img src="foo.png" /></figure>' );
 
 		expect( getModelData( document, { withoutSelection: true } ) ).to.equal( '<image imageStyle="side" src="foo.png"></image>' );
+		expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
+			'<figure class="image ck-widget side-class" contenteditable="false">' +
+				'<img src="foo.png"></img>' +
+			'</figure>' );
 	} );
 
 	it( 'should not convert from view to model if class is not defined', () => {
 		editor.setData( '<figure class="image foo-bar"><img src="foo.png" /></figure>' );
 
 		expect( getModelData( document, { withoutSelection: true } ) ).to.equal( '<image src="foo.png"></image>' );
+		expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
+			'<figure class="image ck-widget" contenteditable="false"><img src="foo.png"></img></figure>'
+		);
 	} );
 
 	it( 'should not convert from view to model when not in image figure', () => {
 		editor.setData( '<figure class="side-class"></figure>' );
 
 		expect( getModelData( document, { withoutSelection: true } ) ).to.equal( '' );
+		expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal( '' );
 	} );
 
 	it( 'should not convert from view to model if schema prevents it', () => {
@@ -75,6 +83,9 @@ describe( 'ImageStyleEngine', () => {
 		editor.setData( '<figure class="image side-class"><img src="foo.png" /></figure>' );
 
 		expect( getModelData( document, { withoutSelection: true } ) ).to.equal( '<image src="foo.png"></image>' );
+		expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
+			'<figure class="image ck-widget" contenteditable="false"><img src="foo.png"></img></figure>'
+		);
 	} );
 
 	it( 'should convert model to view: adding attribute', () => {
@@ -87,6 +98,9 @@ describe( 'ImageStyleEngine', () => {
 		} );
 
 		expect( editor.getData() ).to.equal( '<figure class="image side-class"><img src="foo.png"></figure>' );
+		expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
+			'<figure class="image ck-widget side-class" contenteditable="false"><img src="foo.png"></img></figure>'
+		);
 	} );
 
 	it( 'should convert model to view: removing attribute', () => {
@@ -99,6 +113,9 @@ describe( 'ImageStyleEngine', () => {
 		} );
 
 		expect( editor.getData() ).to.equal( '<figure class="image"><img src="foo.png"></figure>' );
+		expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
+			'<figure class="image ck-widget" contenteditable="false"><img src="foo.png"></img></figure>'
+		);
 	} );
 
 	it( 'should convert model to view: change attribute', () => {
@@ -193,6 +210,9 @@ describe( 'ImageStyleEngine', () => {
 		} );
 
 		expect( editor.getData() ).to.equal( '<figure class="image"><img src="foo.png"></figure>' );
+		expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
+			'<figure class="image ck-widget" contenteditable="false"><img src="foo.png"></img></figure>'
+		);
 	} );
 
 	it( 'should not convert from model to view if style is not present: change attribute', () => {
@@ -205,6 +225,9 @@ describe( 'ImageStyleEngine', () => {
 		} );
 
 		expect( editor.getData() ).to.equal( '<figure class="image"><img src="foo.png"></figure>' );
+		expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
+			'<figure class="image ck-widget" contenteditable="false"><img src="foo.png"></img></figure>'
+		);
 	} );
 
 	it( 'should not convert from model to view if style is not present: remove attribute', () => {
@@ -217,5 +240,8 @@ describe( 'ImageStyleEngine', () => {
 		} );
 
 		expect( editor.getData() ).to.equal( '<figure class="image"><img src="foo.png"></figure>' );
+		expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
+			'<figure class="image ck-widget" contenteditable="false"><img src="foo.png"></img></figure>'
+		);
 	} );
 } );