@@ -79,7 +79,9 @@ describe('Dialog', async () => {
7979 } ) ;
8080
8181 it ( 'should add a vNode in the dialog' , async ( ) => {
82- await editor . plugins . get ( Layout ) . append ( 'aaa' , 'float' ) ;
82+ await editor . execBatch ( ( ) => {
83+ return editor . plugins . get ( Layout ) . append ( 'aaa' , 'float' ) ;
84+ } ) ;
8385 expect ( container . innerHTML . replace ( / [ \s \n ] + / g, ' ' ) ) . to . equal (
8486 [
8587 '<jw-editor>' ,
@@ -97,14 +99,18 @@ describe('Dialog', async () => {
9799 ) ;
98100 } ) ;
99101 it ( 'should add a vNode in the dialog and hide it' , async ( ) => {
100- await editor . plugins . get ( Layout ) . append ( 'aaa' , 'float' ) ;
102+ await editor . execBatch ( ( ) => {
103+ return editor . plugins . get ( Layout ) . append ( 'aaa' , 'float' ) ;
104+ } ) ;
101105 await editor . execCommand ( 'hide' , { componentId : 'aaa' } ) ;
102106 expect ( container . innerHTML . replace ( / [ \s \n ] + / g, ' ' ) ) . to . equal (
103107 [ '<jw-editor>' , '<main></main>' , '</jw-editor>' ] . join ( '' ) ,
104108 ) ;
105109 } ) ;
106110 it ( 'should add a vNode in the dialog and show it' , async ( ) => {
107- await editor . plugins . get ( Layout ) . append ( 'aaa' , 'float' ) ;
111+ await editor . execBatch ( ( ) => {
112+ return editor . plugins . get ( Layout ) . append ( 'aaa' , 'float' ) ;
113+ } ) ;
108114 await editor . execCommand ( 'hide' , { componentId : 'aaa' } ) ;
109115 await editor . execCommand ( 'show' , { componentId : 'aaa' } ) ;
110116 expect ( container . innerHTML . replace ( / [ \s \n ] + / g, ' ' ) ) . to . equal (
@@ -124,7 +130,9 @@ describe('Dialog', async () => {
124130 ) ;
125131 } ) ;
126132 it ( 'should add a vNode in dialog because dialog is the default zone' , async ( ) => {
127- await editor . plugins . get ( Layout ) . append ( 'aaa' , 'not available zone' ) ;
133+ await editor . execBatch ( ( ) => {
134+ return editor . plugins . get ( Layout ) . append ( 'aaa' , 'not available zone' ) ;
135+ } ) ;
128136 await editor . execCommand ( 'show' , { componentId : 'aaa' } ) ;
129137 expect ( container . innerHTML . replace ( / [ \s \n ] + / g, ' ' ) ) . to . equal (
130138 [
@@ -143,10 +151,14 @@ describe('Dialog', async () => {
143151 ) ;
144152 } ) ;
145153 it ( 'should add 2 vNodes in the dialog and show it' , async ( ) => {
146- await editor . plugins . get ( Layout ) . append ( 'aaa' , 'float' ) ;
154+ await editor . execBatch ( ( ) => {
155+ return editor . plugins . get ( Layout ) . append ( 'aaa' , 'float' ) ;
156+ } ) ;
147157 await editor . execCommand ( 'show' , { componentId : 'aaa' } ) ;
148158
149- await editor . plugins . get ( Layout ) . append ( 'bbb' , 'not available zone' ) ;
159+ await editor . execBatch ( ( ) => {
160+ return editor . plugins . get ( Layout ) . append ( 'bbb' , 'not available zone' ) ;
161+ } ) ;
150162 await editor . execCommand ( 'show' , { componentId : 'bbb' } ) ;
151163
152164 expect ( container . innerHTML . replace ( / [ \s \n ] + / g, ' ' ) ) . to . equal (
@@ -174,10 +186,14 @@ describe('Dialog', async () => {
174186 ) ;
175187 } ) ;
176188 it ( 'should close 2 dialogs with the X button' , async ( ) => {
177- await editor . plugins . get ( Layout ) . append ( 'aaa' , 'float' ) ;
189+ await editor . execBatch ( ( ) => {
190+ return editor . plugins . get ( Layout ) . append ( 'aaa' , 'float' ) ;
191+ } ) ;
178192 await editor . execCommand ( 'show' , { componentId : 'aaa' } ) ;
179193
180- await editor . plugins . get ( Layout ) . append ( 'bbb' , 'not available zone' ) ;
194+ await editor . execBatch ( ( ) => {
195+ return editor . plugins . get ( Layout ) . append ( 'bbb' , 'not available zone' ) ;
196+ } ) ;
181197 await editor . execCommand ( 'show' , { componentId : 'bbb' } ) ;
182198
183199 await click (
@@ -217,10 +233,14 @@ describe('Dialog', async () => {
217233 expect ( section . parent ) . to . instanceOf ( DialogZoneNode ) ;
218234 } ) ;
219235 it ( 'should close 2 dialogs it with the backdrop' , async ( ) => {
220- await editor . plugins . get ( Layout ) . append ( 'aaa' , 'float' ) ;
236+ await editor . execBatch ( ( ) => {
237+ return editor . plugins . get ( Layout ) . append ( 'aaa' , 'float' ) ;
238+ } ) ;
221239 await editor . execCommand ( 'show' , { componentId : 'aaa' } ) ;
222240
223- await editor . plugins . get ( Layout ) . append ( 'bbb' , 'not available zone' ) ;
241+ await editor . execBatch ( ( ) => {
242+ return editor . plugins . get ( Layout ) . append ( 'bbb' , 'not available zone' ) ;
243+ } ) ;
224244 await editor . execCommand ( 'show' , { componentId : 'bbb' } ) ;
225245
226246 await click (
@@ -259,7 +279,9 @@ describe('Dialog', async () => {
259279 expect ( section . parent ) . to . instanceOf ( DialogZoneNode ) ;
260280 } ) ;
261281 it ( 'should close a dialog and re-open a dialog' , async ( ) => {
262- await editor . plugins . get ( Layout ) . append ( 'aaa' , 'float' ) ;
282+ await editor . execBatch ( ( ) => {
283+ return editor . plugins . get ( Layout ) . append ( 'aaa' , 'float' ) ;
284+ } ) ;
263285 await editor . execCommand ( 'show' , { componentId : 'aaa' } ) ;
264286
265287 await click (
@@ -270,7 +292,9 @@ describe('Dialog', async () => {
270292 [ '<jw-editor>' , '<main></main>' , '</jw-editor>' ] . join ( '' ) ,
271293 ) ;
272294
273- await editor . plugins . get ( Layout ) . append ( 'bbb' , 'not available zone' ) ;
295+ await editor . execBatch ( ( ) => {
296+ return editor . plugins . get ( Layout ) . append ( 'bbb' , 'not available zone' ) ;
297+ } ) ;
274298 await editor . execCommand ( 'show' , { componentId : 'bbb' } ) ;
275299
276300 expect ( container . innerHTML . replace ( / [ \s \n ] + / g, ' ' ) ) . to . equal (
@@ -291,7 +315,9 @@ describe('Dialog', async () => {
291315 ) ;
292316 } ) ;
293317 it ( 'should not close the dialog if click in content' , async ( ) => {
294- await editor . plugins . get ( Layout ) . append ( 'bbb' , 'not available zone' ) ;
318+ await editor . execBatch ( ( ) => {
319+ return editor . plugins . get ( Layout ) . append ( 'bbb' , 'not available zone' ) ;
320+ } ) ;
295321 await editor . execCommand ( 'show' , { componentId : 'bbb' } ) ;
296322
297323 await click ( Array . from ( container . querySelectorAll ( 'jw-dialog jw-content' ) ) . pop ( ) ) ;
@@ -314,7 +340,9 @@ describe('Dialog', async () => {
314340 ) ;
315341 } ) ;
316342 it ( 'should hide a vNode in dialog (without remove the vNode)' , async ( ) => {
317- await editor . plugins . get ( Layout ) . append ( 'bbb' , 'not available zone' ) ;
343+ await editor . execBatch ( ( ) => {
344+ return editor . plugins . get ( Layout ) . append ( 'bbb' , 'not available zone' ) ;
345+ } ) ;
318346
319347 await editor . execCommand ( 'hide' , { componentId : 'bbb' } ) ;
320348
0 commit comments