Ver código fonte

Use async/await in restricted document tests.

Maciej Gołaszewski 6 anos atrás
pai
commit
5b7928c015

+ 3 - 7
packages/ckeditor5-restricted-editing/tests/restricteddocumentediting.js

@@ -18,13 +18,9 @@ describe( 'RestrictedDocumentEditing', () => {
 
 	testUtils.createSinonSandbox();
 
-	beforeEach( () => {
-		return VirtualTestEditor
-			.create( { plugins: [ Paragraph, RestrictedDocument ] } )
-			.then( newEditor => {
-				editor = newEditor;
-				model = editor.model;
-			} );
+	beforeEach( async () => {
+		editor = await VirtualTestEditor.create( { plugins: [ Paragraph, RestrictedDocument ] } );
+		model = editor.model;
 	} );
 
 	afterEach( () => {

+ 5 - 9
packages/ckeditor5-restricted-editing/tests/restricteddocumentui.js

@@ -18,19 +18,15 @@ describe( 'RestrictedDocumentUI', () => {
 
 	testUtils.createSinonSandbox();
 
-	beforeEach( () => {
+	beforeEach( async () => {
 		const editorElement = document.createElement( 'div' );
 		document.body.appendChild( editorElement );
 
-		return ClassicTestEditor
-			.create( editorElement, {
-				plugins: [ Paragraph, RestrictedDocument, RestrictedDocumentUI ]
-			} )
-			.then( newEditor => {
-				editor = newEditor;
+		editor = await ClassicTestEditor.create( editorElement, {
+			plugins: [ Paragraph, RestrictedDocument, RestrictedDocumentUI ]
+		} );
 
-				buttonView = editor.ui.componentFactory.create( 'nonRestricted' );
-			} );
+		buttonView = editor.ui.componentFactory.create( 'nonRestricted' );
 	} );
 
 	afterEach( () => {