Maciej Bukowski 6 lat temu
rodzic
commit
0b172f6812
1 zmienionych plików z 10 dodań i 1 usunięć
  1. 10 1
      packages/ckeditor5-watchdog/tests/watchdog.js

+ 10 - 1
packages/ckeditor5-watchdog/tests/watchdog.js

@@ -580,12 +580,15 @@ describe( 'Watchdog', () => {
 			const originalErrorHandler = window.onerror;
 			window.onerror = undefined;
 
+			const consoleErrorStub = sinon.stub( console, 'error' );
+
 			return watchdog.create( document.createElement( 'div' ), {
 				initialData: '<p>foo</p>',
 				plugins: [ Paragraph ]
 			} ).then( () => {
+				const editorGetDataError = new Error( 'Some error' );
 				const getDataStub = sinon.stub( watchdog.editor, 'getData' )
-					.throwsException( new Error( 'Some error' ) );
+					.throwsException( editorGetDataError );
 
 				setTimeout( () => throwCKEditorError( 'foo', watchdog.editor ) );
 
@@ -602,6 +605,12 @@ describe( 'Watchdog', () => {
 						sinon.assert.calledOnce( getDataStub );
 						expect( watchdog.editor.getData() ).to.equal( '<p>foo</p>' );
 
+						sinon.assert.calledWith(
+							consoleErrorStub,
+							editorGetDataError,
+							'An error happened during restoring editor data. Editor will be restored from the previously saved data.'
+						);
+
 						watchdog.destroy().then( res );
 					} );
 				} );