Maciej Bukowski před 5 roky
rodič
revize
471fff225c

+ 18 - 21
packages/ckeditor5-watchdog/tests/editorwatchdog.js

@@ -1026,7 +1026,7 @@ describe( 'EditorWatchdog', () => {
 	} );
 
 	describe( 'multi-root editors', () => {
-		it( 'should support multi-root editors', () => {
+		it( 'should support multi-root editors', async () => {
 			class MultiRootEditor extends Editor {
 				constructor( sourceElements, config ) {
 					super( config );
@@ -1058,29 +1058,26 @@ describe( 'EditorWatchdog', () => {
 			const originalErrorHandler = window.onerror;
 			window.onerror = undefined;
 
-			return watchdog
-				.create( {
-					header: element
-				}, {
-					initialData: {
-						header: '<p>Foo</p>'
-					},
-					plugins: [ Paragraph ]
-				} )
-				.then( () => {
-					expect( watchdog.editor.data.get( { rootName: 'header' } ) ).to.equal( '<p>Foo</p>' );
+			await watchdog.create( {
+				header: element
+			}, {
+				initialData: {
+					header: '<p>Foo</p>'
+				},
+				plugins: [ Paragraph ]
+			} );
 
-					setTimeout( () => throwCKEditorError( 'foo', watchdog.editor ) );
+			expect( watchdog.editor.data.get( { rootName: 'header' } ) ).to.equal( '<p>Foo</p>' );
 
-					return new Promise( res => {
-						window.onerror = originalErrorHandler;
-						expect( watchdog.editor.data.get( { rootName: 'header' } ) ).to.equal( '<p>Foo</p>' );
+			setTimeout( () => throwCKEditorError( 'foo', watchdog.editor ) );
 
-						res();
-					} );
-				} ).then( () => {
-					return watchdog.destroy();
-				} );
+			await waitCycle();
+
+			window.onerror = originalErrorHandler;
+
+			expect( watchdog.editor.data.get( { rootName: 'header' } ) ).to.equal( '<p>Foo</p>' );
+
+			await watchdog.destroy();
 		} );
 	} );
 } );

+ 2 - 2
packages/ckeditor5-watchdog/tests/watchdog.js

@@ -9,7 +9,7 @@ describe( 'Watchdog', () => {
 	it( 'should not be created directly', () => {
 		expect( () => {
 			// eslint-disable-next-line no-unused-vars
-			const watchdog = new Watchdog();
+			const watchdog = new Watchdog( {} );
 		} ).to.throw( /Please, use `EditorWatchdog` if you have used the `Watchdog` class previously\./ );
 	} );
 
@@ -21,7 +21,7 @@ describe( 'Watchdog', () => {
 
 		expect( () => {
 			// eslint-disable-next-line no-unused-vars
-			const fooWatchdog = new FooWatchdog();
+			const fooWatchdog = new FooWatchdog( {} );
 		} ).to.not.throw();
 	} );
 } );