瀏覽代碼

Tests: Corrected test connected with checking if changes are done in enqueueChanges call.

Szymon Cofalik 8 年之前
父節點
當前提交
9398d390e9
共有 1 個文件被更改,包括 7 次插入3 次删除
  1. 7 3
      packages/ckeditor5-enter/tests/entercommand.js

+ 7 - 3
packages/ckeditor5-enter/tests/entercommand.js

@@ -44,12 +44,16 @@ describe( 'EnterCommand', () => {
 		it( 'enters a block using enqueueChanges', () => {
 			setData( doc, '<p>foo[]</p>' );
 
-			const spy = sinon.spy( doc, 'enqueueChanges' );
+			doc.enqueueChanges( () => {
+				editor.execute( 'enter' );
 
-			editor.execute( 'enter' );
+				// We expect that command is executed in enqueue changes block. Since we are already in
+				// an enqueued block, the command execution will be postponed. Hence, no changes.
+				expect( getData( doc, { withoutSelection: true } ) ).to.equal( '<p>foo</p>' );
+			} );
 
+			// After all enqueued changes are done, the command execution is reflected.
 			expect( getData( doc, { withoutSelection: true } ) ).to.equal( '<p>foo</p><p></p>' );
-			expect( spy.calledOnce ).to.be.true;
 		} );
 	} );