@@ -25,13 +25,9 @@ test.describe('Extensions', () => {
25
25
test ( `document.execCommand("insertText")` , async ( { page} ) => {
26
26
await focusEditor ( page ) ;
27
27
28
- await evaluate (
29
- page ,
30
- ( ) => {
31
- document . execCommand ( 'insertText' , false , 'foo' ) ;
32
- } ,
33
- [ ] ,
34
- ) ;
28
+ await evaluate ( page , ( ) => {
29
+ document . execCommand ( 'insertText' , false , 'foo' ) ;
30
+ } , [ ] ) ;
35
31
await assertHTML (
36
32
page ,
37
33
html `
@@ -58,31 +54,27 @@ test.describe('Extensions', () => {
58
54
}
59
55
await focusEditor ( page ) ;
60
56
61
- await evaluate (
62
- page ,
63
- ( ) => {
64
- function paste ( ) {
65
- const dataTransfer = new DataTransfer ( ) ;
66
- function dispatchPaste ( target , text ) {
67
- dataTransfer . setData ( 'text/plain' , text ) ;
68
- target . dispatchEvent (
69
- new ClipboardEvent ( 'paste' , {
70
- bubbles : true ,
71
- cancelable : true ,
72
- clipboardData : dataTransfer ,
73
- } ) ,
74
- ) ;
75
- dataTransfer . clearData ( ) ;
76
- }
77
- return dispatchPaste ;
57
+ await evaluate ( page , ( ) => {
58
+ function paste ( ) {
59
+ const dataTransfer = new DataTransfer ( ) ;
60
+ function dispatchPaste ( target , text ) {
61
+ dataTransfer . setData ( 'text/plain' , text ) ;
62
+ target . dispatchEvent (
63
+ new ClipboardEvent ( 'paste' , {
64
+ bubbles : true ,
65
+ cancelable : true ,
66
+ clipboardData : dataTransfer ,
67
+ } ) ,
68
+ ) ;
69
+ dataTransfer . clearData ( ) ;
78
70
}
71
+ return dispatchPaste ;
72
+ }
79
73
80
- const editor = document . querySelector ( 'div[contenteditable="true"]' ) ;
81
- const dispatchPaste = paste ( ) ;
82
- dispatchPaste ( editor , 'foo' ) ;
83
- } ,
84
- [ ] ,
85
- ) ;
74
+ const editor = document . querySelector ( 'div[contenteditable="true"]' ) ;
75
+ const dispatchPaste = paste ( ) ;
76
+ dispatchPaste ( editor , 'foo' ) ;
77
+ } , [ ] ) ;
86
78
await assertHTML (
87
79
page ,
88
80
html `
@@ -214,29 +206,25 @@ test.describe('Extensions', () => {
214
206
await page . keyboard . press ( 'ArrowUp' ) ;
215
207
216
208
// Selection is on the last paragraph
217
- await evaluate (
218
- page ,
219
- async ( ) => {
220
- const editor = document . querySelector ( 'div[contenteditable="true"]' ) ;
221
- const selection = window . getSelection ( ) ;
222
- const secondParagraphTextNode =
223
- editor . firstChild . nextSibling . firstChild . firstChild ;
224
- selection . setBaseAndExtent (
225
- secondParagraphTextNode ,
226
- 0 ,
227
- secondParagraphTextNode ,
228
- 3 ,
229
- ) ;
209
+ await evaluate ( page , async ( ) => {
210
+ const editor = document . querySelector ( 'div[contenteditable="true"]' ) ;
211
+ const selection = window . getSelection ( ) ;
212
+ const secondParagraphTextNode =
213
+ editor . firstChild . nextSibling . firstChild . firstChild ;
214
+ selection . setBaseAndExtent (
215
+ secondParagraphTextNode ,
216
+ 0 ,
217
+ secondParagraphTextNode ,
218
+ 3 ,
219
+ ) ;
230
220
231
- await new Promise ( ( resolve ) => {
232
- setTimeout ( ( ) => {
233
- document . execCommand ( 'insertText' , false , 'and' ) ;
234
- resolve ( ) ;
235
- } , 50 ) ;
236
- } ) ;
237
- } ,
238
- [ ] ,
239
- ) ;
221
+ await new Promise ( ( resolve ) => {
222
+ setTimeout ( ( ) => {
223
+ document . execCommand ( 'insertText' , false , 'and' ) ;
224
+ resolve ( ) ;
225
+ } , 50 ) ;
226
+ } ) ;
227
+ } , [ ] ) ;
240
228
await assertHTML (
241
229
page ,
242
230
html `
@@ -278,13 +266,9 @@ test.describe('Extensions', () => {
278
266
focusPath : [ 0 , 0 , 0 ] ,
279
267
} ) ;
280
268
281
- await evaluate (
282
- page ,
283
- ( ) => {
284
- document . execCommand ( 'insertText' , false , 'New text' ) ;
285
- } ,
286
- [ ] ,
287
- ) ;
269
+ await evaluate ( page , ( ) => {
270
+ document . execCommand ( 'insertText' , false , 'New text' ) ;
271
+ } , [ ] ) ;
288
272
await assertHTML (
289
273
page ,
290
274
html `
@@ -321,13 +305,9 @@ test.describe('Extensions', () => {
321
305
focusPath : [ 0 , 0 , 0 ] ,
322
306
} ) ;
323
307
324
- await evaluate (
325
- page ,
326
- ( ) => {
327
- document . execCommand ( 'insertText' , false , 'New text' ) ;
328
- } ,
329
- [ ] ,
330
- ) ;
308
+ await evaluate ( page , ( ) => {
309
+ document . execCommand ( 'insertText' , false , 'New text' ) ;
310
+ } , [ ] ) ;
331
311
await assertHTML (
332
312
page ,
333
313
html `
0 commit comments