Răsfoiți Sursa

Updated tests for disabled WidgetTypeAround plugin.

Kuba Niegowski 5 ani în urmă
părinte
comite
de82f2c605

+ 10 - 6
packages/ckeditor5-widget/tests/widgettypearound/widgettypearound.js

@@ -844,12 +844,12 @@ describe( 'WidgetTypeAround', () => {
 				it( 'should not work when the plugin is disabled', () => {
 					setModelData( editor.model, '[<blockWidget></blockWidget>]' );
 
+					editor.plugins.get( WidgetTypeAround ).isEnabled = false;
+
 					model.change( writer => {
 						writer.setSelectionAttribute( TYPE_AROUND_SELECTION_ATTRIBUTE, 'after' );
 					} );
 
-					editor.plugins.get( WidgetTypeAround ).isEnabled = false;
-
 					fireKeyboardEvent( 'enter' );
 					expect( getModelData( model ) ).to.equal( '<paragraph>[]</paragraph>' );
 				} );
@@ -1029,12 +1029,12 @@ describe( 'WidgetTypeAround', () => {
 				it( 'should not work when the plugin is disabled', () => {
 					setModelData( editor.model, '[<blockWidget></blockWidget>]' );
 
+					editor.plugins.get( WidgetTypeAround ).isEnabled = false;
+
 					model.change( writer => {
 						writer.setSelectionAttribute( TYPE_AROUND_SELECTION_ATTRIBUTE, 'before' );
 					} );
 
-					editor.plugins.get( WidgetTypeAround ).isEnabled = false;
-
 					fireKeyboardEvent( 'a' );
 					fireMutation( 'a' );
 
@@ -1382,6 +1382,10 @@ describe( 'WidgetTypeAround', () => {
 
 				editor.plugins.get( WidgetTypeAround ).isEnabled = false;
 
+				model.change( writer => {
+					writer.setSelectionAttribute( TYPE_AROUND_SELECTION_ATTRIBUTE, 'before' );
+				} );
+
 				fireDeleteEvent();
 				expect( getModelData( model ) ).to.equal( '<paragraph>[]</paragraph>' );
 			} );
@@ -1544,12 +1548,12 @@ describe( 'WidgetTypeAround', () => {
 		it( 'should not work when the plugin is disabled', () => {
 			setModelData( editor.model, '[<blockWidget></blockWidget>]' );
 
+			editor.plugins.get( WidgetTypeAround ).isEnabled = false;
+
 			model.change( writer => {
 				writer.setSelectionAttribute( TYPE_AROUND_SELECTION_ATTRIBUTE, 'before' );
 			} );
 
-			editor.plugins.get( WidgetTypeAround ).isEnabled = false;
-
 			model.insertContent( createParagraph( 'bar' ) );
 
 			expect( getModelData( model ) ).to.equal( '<paragraph>bar[]</paragraph>' );