瀏覽代碼

Add test to verify that refresh item is not called too many times.

Maciej Gołaszewski 5 年之前
父節點
當前提交
9f4c0e2745
共有 1 個文件被更改,包括 15 次插入0 次删除
  1. 15 0
      packages/ckeditor5-table/tests/converters/table-cell-refresh-post-fixer.js

+ 15 - 0
packages/ckeditor5-table/tests/converters/table-cell-refresh-post-fixer.js

@@ -304,6 +304,21 @@ describe( 'Table cell refresh post-fixer', () => {
 		sinon.assert.notCalled( refreshItemSpy );
 	} );
 
+	it( 'should do nothing on adding <paragraph> to existing paragraphs', () => {
+		editor.setData( viewTable( [ [ '<p>a</p><p>b</p>' ] ] ) );
+
+		const table = root.getChild( 0 );
+
+		model.change( writer => {
+			writer.insertElement( 'paragraph', table.getNodeByPath( [ 0, 0, 1 ] ), 'after' );
+		} );
+
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
+			[ '<p>a</p><p>b</p><p></p>' ]
+		], { asWidget: true } ) );
+		sinon.assert.notCalled( refreshItemSpy );
+	} );
+
 	it( 'should do nothing when setting attribute on block item other then <paragraph>', () => {
 		editor.setData( viewTable( [ [ '<div>foo</div>' ] ] ) );