ソースを参照

Tests: Align tests code to changes in ckeditor5-engine selection post fixer.

Maciej Gołaszewski 7 年 前
コミット
a9325bf2f4
1 ファイル変更47 行追加35 行削除
  1. 47 35
      packages/ckeditor5-list/tests/listediting.js

+ 47 - 35
packages/ckeditor5-list/tests/listediting.js

@@ -2890,10 +2890,12 @@ describe( 'ListEditing', () => {
 		describe( 'insert', () => {
 			function test( testName, input, inserted, output ) {
 				it( testName, () => {
-					setModelData( model, input );
+					model.enqueueChange( 'transparent', () => {
+						setModelData( model, input );
 
-					model.change( writer => {
-						writer.insert( parseModel( inserted, model.schema ), modelDoc.selection.getFirstPosition() );
+						model.change( writer => {
+							writer.insert( parseModel( inserted, model.schema ), modelDoc.selection.getFirstPosition() );
+						} );
 					} );
 
 					expect( getModelData( model, { withoutSelection: true } ) ).to.equal( output );
@@ -3413,16 +3415,18 @@ describe( 'ListEditing', () => {
 		} );
 
 		it( 'should work if items are pasted between listItem elements', () => {
-			setModelData( model,
-				'<listItem type="bulleted" indent="0">A</listItem>' +
-				'<listItem type="bulleted" indent="1">B</listItem>[]' +
-				'<listItem type="bulleted" indent="2">C</listItem>'
-			);
+			model.enqueueChange( 'transparent', () => {
+				setModelData( model,
+					'<listItem type="bulleted" indent="0">A</listItem>' +
+					'<listItem type="bulleted" indent="1">B</listItem>[]' +
+					'<listItem type="bulleted" indent="2">C</listItem>'
+				);
 
-			const clipboard = editor.plugins.get( 'Clipboard' );
+				const clipboard = editor.plugins.get( 'Clipboard' );
 
-			clipboard.fire( 'inputTransformation', {
-				content: parseView( '<ul><li>X<ul><li>Y</li></ul></li></ul>' )
+				clipboard.fire( 'inputTransformation', {
+					content: parseView( '<ul><li>X<ul><li>Y</li></ul></li></ul>' )
+				} );
 			} );
 
 			expect( getModelData( model ) ).to.equal(
@@ -3481,18 +3485,20 @@ describe( 'ListEditing', () => {
 		} );
 
 		it( 'should correctly handle item that is pasted without its parent', () => {
-			setModelData( model,
-				'<paragraph>Foo</paragraph>' +
-				'<listItem type="numbered" indent="0">A</listItem>' +
-				'<listItem type="numbered" indent="1">B</listItem>' +
-				'[]' +
-				'<paragraph>Bar</paragraph>'
-			);
+			model.enqueueChange( 'transparent', () => {
+				setModelData( model,
+					'<paragraph>Foo</paragraph>' +
+					'<listItem type="numbered" indent="0">A</listItem>' +
+					'<listItem type="numbered" indent="1">B</listItem>' +
+					'[]' +
+					'<paragraph>Bar</paragraph>'
+				);
 
-			const clipboard = editor.plugins.get( 'Clipboard' );
+				const clipboard = editor.plugins.get( 'Clipboard' );
 
-			clipboard.fire( 'inputTransformation', {
-				content: parseView( '<li>X</li>' )
+				clipboard.fire( 'inputTransformation', {
+					content: parseView( '<li>X</li>' )
+				} );
 			} );
 
 			expect( getModelData( model ) ).to.equal(
@@ -3505,18 +3511,20 @@ describe( 'ListEditing', () => {
 		} );
 
 		it( 'should correctly handle item that is pasted without its parent #2', () => {
-			setModelData( model,
-				'<paragraph>Foo</paragraph>' +
-				'<listItem type="numbered" indent="0">A</listItem>' +
-				'<listItem type="numbered" indent="1">B</listItem>' +
-				'[]' +
-				'<paragraph>Bar</paragraph>'
-			);
+			model.enqueueChange( 'transparent', () => {
+				setModelData( model,
+					'<paragraph>Foo</paragraph>' +
+					'<listItem type="numbered" indent="0">A</listItem>' +
+					'<listItem type="numbered" indent="1">B</listItem>' +
+					'[]' +
+					'<paragraph>Bar</paragraph>'
+				);
 
-			const clipboard = editor.plugins.get( 'Clipboard' );
+				const clipboard = editor.plugins.get( 'Clipboard' );
 
-			clipboard.fire( 'inputTransformation', {
-				content: parseView( '<li>X<ul><li>Y</li></ul></li>' )
+				clipboard.fire( 'inputTransformation', {
+					content: parseView( '<li>X<ul><li>Y</li></ul></li>' )
+				} );
 			} );
 
 			expect( getModelData( model ) ).to.equal(
@@ -3921,17 +3929,21 @@ describe( 'ListEditing', () => {
 
 	function _test( testName, input, output, actionCallback ) {
 		it( testName, () => {
-			setModelData( model, input );
+			model.enqueueChange( 'transparet', () => {
+				setModelData( model, input );
 
-			actionCallback();
+				actionCallback();
+			} );
 
 			expect( getViewData( view, { withoutSelection: true } ) ).to.equal( output );
 		} );
 
 		it( testName + ' (undo integration)', () => {
-			setModelData( model, input );
+			model.enqueueChange( 'transparent', () => {
+				setModelData( model, input );
+			} );
 
-			const modelBefore = input;
+			const modelBefore = getModelData( model );
 			const viewBefore = getViewData( view, { withoutSelection: true } );
 
 			actionCallback();