浏览代码

Tests: Since editor is focused for each test move it to beforeEach.

Marek Lewandowski 5 年之前
父节点
当前提交
296d8e63f2
共有 1 个文件被更改,包括 2 次插入11 次删除
  1. 2 11
      packages/ckeditor5-widget/tests/widgetresize.js

+ 2 - 11
packages/ckeditor5-widget/tests/widgetresize.js

@@ -69,6 +69,8 @@ describe( 'WidgetResize', () => {
 
 		setModelData( editor.model, '[<widget></widget>]' );
 
+		focusEditor( editor );
+
 		widget = view.document.getRoot().getChild( 0 );
 		widgetModel = editor.model.document.getRoot().getChild( 0 );
 
@@ -108,8 +110,6 @@ describe( 'WidgetResize', () => {
 		it( 'doesnt break when called with unexpected element', async () => {
 			const unrelatedElement = document.createElement( 'div' );
 
-			focusEditor( editor );
-
 			resizer.redraw(); // @todo this shouldn't be necessary.
 
 			editor.plugins.get( WidgetResize )._mouseDownListener( {}, {
@@ -118,8 +118,6 @@ describe( 'WidgetResize', () => {
 		} );
 
 		it( 'passes new width to the options.onCommit()', async () => {
-			focusEditor( editor );
-
 			resizer.redraw(); // @todo this shouldn't be necessary.
 
 			const usedResizer = 'top-right';
@@ -154,7 +152,6 @@ describe( 'WidgetResize', () => {
 	} );
 
 	it( 'nothing bad happens if activeResizer got unset', async () => {
-		focusEditor( editor );
 		const resizer = createResizer( {
 			isCentered: () => true
 		} );
@@ -184,8 +181,6 @@ describe( 'WidgetResize', () => {
 		} );
 
 		it( 'assumes a centered image if no isCentered option is provided', async () => {
-			focusEditor( editor );
-
 			resizer.redraw(); // @todo this shouldn't be necessary.
 
 			const usedResizer = 'top-right';
@@ -216,8 +211,6 @@ describe( 'WidgetResize', () => {
 		} );
 
 		it( 'properly sets the state for subsequent resizes', async () => {
-			focusEditor( editor );
-
 			resizer.redraw(); // @todo this shouldn't be necessary.
 
 			const usedResizer = 'top-right';
@@ -260,8 +253,6 @@ describe( 'WidgetResize', () => {
 		} );
 
 		it( 'properly sets the state for subsequent resizes', async () => {
-			focusEditor( editor );
-
 			resizer.redraw(); // @todo this shouldn't be necessary.
 
 			const usedResizer = 'top-right';