@wordpress/format-library 4.12.0 → 4.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,476 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`LinksUI LinksUI renders 1`] = `
4
+ <Modal
5
+ animationInTiming={400}
6
+ animationOutTiming={300}
7
+ backdropOpacity={0.2}
8
+ backdropTransitionInTiming={50}
9
+ backdropTransitionOutTiming={50}
10
+ isVisible={true}
11
+ onAccessibilityEscape={[Function]}
12
+ onBackButtonPress={[Function]}
13
+ onBackdropPress={[Function]}
14
+ onModalHide={[Function]}
15
+ onMoveShouldSetResponder={[Function]}
16
+ onMoveShouldSetResponderCapture={[Function]}
17
+ onSwipeComplete={[Function]}
18
+ preferredColorScheme="light"
19
+ swipeDirection="down"
20
+ testID="link-settings-modal"
21
+ >
22
+ <View
23
+ behavior={false}
24
+ style={
25
+ {
26
+ "borderColor": "rgba(0, 0, 0, 0.1)",
27
+ "flex": undefined,
28
+ "marginTop": 0,
29
+ "maxWidth": 512,
30
+ }
31
+ }
32
+ >
33
+ <View
34
+ onLayout={[Function]}
35
+ testID="link-settings-modal-header"
36
+ >
37
+ <View />
38
+ </View>
39
+ <View
40
+ style={
41
+ {
42
+ "maxHeight": 787.06,
43
+ }
44
+ }
45
+ >
46
+ <View
47
+ style={
48
+ [
49
+ undefined,
50
+ {
51
+ "height": 1,
52
+ },
53
+ ]
54
+ }
55
+ >
56
+ <RNGestureHandlerRootView
57
+ style={
58
+ {
59
+ "flex": 1,
60
+ }
61
+ }
62
+ >
63
+ <View
64
+ onLayout={[Function]}
65
+ style={
66
+ {
67
+ "flex": 1,
68
+ }
69
+ }
70
+ >
71
+ <View
72
+ pointerEvents="box-none"
73
+ style={
74
+ {
75
+ "bottom": 0,
76
+ "left": 0,
77
+ "position": "absolute",
78
+ "right": 0,
79
+ "top": 0,
80
+ }
81
+ }
82
+ >
83
+ <View
84
+ collapsable={false}
85
+ style={
86
+ {
87
+ "opacity": 1,
88
+ }
89
+ }
90
+ />
91
+ <View
92
+ accessibilityElementsHidden={false}
93
+ closing={false}
94
+ gestureVelocityImpact={0.3}
95
+ importantForAccessibility="auto"
96
+ onClose={[Function]}
97
+ onGestureBegin={[Function]}
98
+ onGestureCanceled={[Function]}
99
+ onOpen={[Function]}
100
+ onTransitionStart={[Function]}
101
+ pointerEvents="box-none"
102
+ style={
103
+ {
104
+ "bottom": 0,
105
+ "left": 0,
106
+ "position": "absolute",
107
+ "right": 0,
108
+ "top": 0,
109
+ }
110
+ }
111
+ transitionSpec={
112
+ {
113
+ "close": {
114
+ "animation": "timing",
115
+ "config": {
116
+ "duration": 200,
117
+ "easing": [Function],
118
+ },
119
+ },
120
+ "open": {
121
+ "animation": "timing",
122
+ "config": {
123
+ "duration": 200,
124
+ "easing": [Function],
125
+ },
126
+ },
127
+ }
128
+ }
129
+ >
130
+ <View
131
+ pointerEvents="box-none"
132
+ style={
133
+ {
134
+ "bottom": 0,
135
+ "left": 0,
136
+ "position": "absolute",
137
+ "right": 0,
138
+ "top": 0,
139
+ }
140
+ }
141
+ />
142
+ <View
143
+ collapsable={false}
144
+ pointerEvents="box-none"
145
+ style={
146
+ {
147
+ "flex": 1,
148
+ }
149
+ }
150
+ >
151
+ <View
152
+ collapsable={false}
153
+ forwardedRef={[Function]}
154
+ handlerTag={1}
155
+ handlerType="PanGestureHandler"
156
+ onGestureHandlerEvent={[Function]}
157
+ onGestureHandlerStateChange={[Function]}
158
+ style={
159
+ {
160
+ "flex": 1,
161
+ "opacity": 1,
162
+ }
163
+ }
164
+ >
165
+ <View
166
+ style={
167
+ [
168
+ {
169
+ "flex": 1,
170
+ "overflow": "hidden",
171
+ },
172
+ [
173
+ {
174
+ "backgroundColor": undefined,
175
+ },
176
+ undefined,
177
+ ],
178
+ ]
179
+ }
180
+ >
181
+ <View
182
+ style={
183
+ {
184
+ "flex": 1,
185
+ "flexDirection": "column-reverse",
186
+ }
187
+ }
188
+ >
189
+ <View
190
+ style={
191
+ {
192
+ "flex": 1,
193
+ }
194
+ }
195
+ >
196
+ <RCTScrollView
197
+ automaticallyAdjustContentInsets={false}
198
+ bounces={false}
199
+ contentContainerStyle={
200
+ [
201
+ {
202
+ "paddingLeft": 8,
203
+ "paddingRight": 8,
204
+ },
205
+ undefined,
206
+ {},
207
+ false,
208
+ ]
209
+ }
210
+ disableScrollViewPanResponder={true}
211
+ onScroll={[Function]}
212
+ safeAreaBottomInset={0}
213
+ scrollEnabled={true}
214
+ scrollEventThrottle={16}
215
+ style={
216
+ {
217
+ "maxHeight": 787.06,
218
+ }
219
+ }
220
+ >
221
+ <View>
222
+ <View
223
+ accessible={false}
224
+ focusable={false}
225
+ onClick={[Function]}
226
+ onResponderGrant={[Function]}
227
+ onResponderMove={[Function]}
228
+ onResponderRelease={[Function]}
229
+ onResponderTerminate={[Function]}
230
+ onResponderTerminationRequest={[Function]}
231
+ onStartShouldSetResponder={[Function]}
232
+ >
233
+ <View
234
+ onLayout={[Function]}
235
+ testID="navigation-screen-linkSettings"
236
+ >
237
+ <View
238
+ accessibilityLabel="Link to, Search or type URL"
239
+ accessibilityRole="button"
240
+ accessibilityState={
241
+ {
242
+ "disabled": false,
243
+ }
244
+ }
245
+ accessible={true}
246
+ collapsable={false}
247
+ focusable={true}
248
+ onClick={[Function]}
249
+ onResponderGrant={[Function]}
250
+ onResponderMove={[Function]}
251
+ onResponderRelease={[Function]}
252
+ onResponderTerminate={[Function]}
253
+ onResponderTerminationRequest={[Function]}
254
+ onStartShouldSetResponder={[Function]}
255
+ style={
256
+ {
257
+ "opacity": 1,
258
+ }
259
+ }
260
+ >
261
+ <View
262
+ pointerEvents="auto"
263
+ style={
264
+ [
265
+ undefined,
266
+ {},
267
+ ]
268
+ }
269
+ >
270
+ <View
271
+ style={
272
+ [
273
+ undefined,
274
+ {},
275
+ ]
276
+ }
277
+ >
278
+ <View>
279
+ <View
280
+ style={
281
+ [
282
+ undefined,
283
+ undefined,
284
+ ]
285
+ }
286
+ >
287
+ <Svg
288
+ height={24}
289
+ lock={true}
290
+ style={{}}
291
+ viewBox="0 0 24 24"
292
+ width={24}
293
+ xmlns="http://www.w3.org/2000/svg"
294
+ >
295
+ Path
296
+ </Svg>
297
+ <View />
298
+ </View>
299
+ <Text
300
+ style={
301
+ [
302
+ undefined,
303
+ {},
304
+ ]
305
+ }
306
+ >
307
+ Link to
308
+ </Text>
309
+ </View>
310
+ </View>
311
+ <Text
312
+ ellipsizeMode="middle"
313
+ numberOfLines={1}
314
+ style={
315
+ {
316
+ "color": "gray",
317
+ }
318
+ }
319
+ >
320
+ Search or type URL
321
+ </Text>
322
+ <View
323
+ pointerEvents="auto"
324
+ style={
325
+ [
326
+ false,
327
+ undefined,
328
+ ]
329
+ }
330
+ >
331
+ <Svg
332
+ height={24}
333
+ style={{}}
334
+ viewBox="0 0 24 24"
335
+ width={24}
336
+ xmlns="http://www.w3.org/2000/svg"
337
+ >
338
+ Path
339
+ </Svg>
340
+ </View>
341
+ </View>
342
+ <View
343
+ style={{}}
344
+ />
345
+ </View>
346
+ <View
347
+ accessibilityHint="Double tap to edit this value"
348
+ accessibilityLabel="Link text. Empty"
349
+ accessibilityRole="button"
350
+ accessibilityState={
351
+ {
352
+ "disabled": false,
353
+ }
354
+ }
355
+ accessible={true}
356
+ collapsable={false}
357
+ focusable={true}
358
+ onClick={[Function]}
359
+ onResponderGrant={[Function]}
360
+ onResponderMove={[Function]}
361
+ onResponderRelease={[Function]}
362
+ onResponderTerminate={[Function]}
363
+ onResponderTerminationRequest={[Function]}
364
+ onStartShouldSetResponder={[Function]}
365
+ style={
366
+ {
367
+ "opacity": 1,
368
+ }
369
+ }
370
+ >
371
+ <View
372
+ pointerEvents="auto"
373
+ style={
374
+ [
375
+ undefined,
376
+ {},
377
+ ]
378
+ }
379
+ >
380
+ <View
381
+ style={
382
+ [
383
+ undefined,
384
+ {},
385
+ ]
386
+ }
387
+ >
388
+ <View>
389
+ <View
390
+ style={
391
+ [
392
+ undefined,
393
+ undefined,
394
+ ]
395
+ }
396
+ >
397
+ <Svg
398
+ height={24}
399
+ lock={true}
400
+ style={{}}
401
+ viewBox="0 0 24 24"
402
+ width={24}
403
+ xmlns="http://www.w3.org/2000/svg"
404
+ >
405
+ Path
406
+ </Svg>
407
+ <View />
408
+ </View>
409
+ <Text
410
+ style={
411
+ [
412
+ undefined,
413
+ {},
414
+ ]
415
+ }
416
+ >
417
+ Link text
418
+ </Text>
419
+ </View>
420
+ </View>
421
+ <TextInput
422
+ disabled={false}
423
+ editable={true}
424
+ keyboardType="default"
425
+ numberOfLines={1}
426
+ onBlur={[Function]}
427
+ onChangeText={[Function]}
428
+ onFocus={[Function]}
429
+ onSubmitEditing={[Function]}
430
+ placeholder="Add link text"
431
+ placeholderTextColor="gray"
432
+ pointerEvents="none"
433
+ preferredColorScheme="light"
434
+ style={{}}
435
+ value=""
436
+ />
437
+ <View
438
+ pointerEvents="auto"
439
+ style={
440
+ [
441
+ false,
442
+ undefined,
443
+ ]
444
+ }
445
+ />
446
+ </View>
447
+ <View />
448
+ </View>
449
+ <View
450
+ style={
451
+ {
452
+ "height": 20,
453
+ }
454
+ }
455
+ />
456
+ </View>
457
+ </View>
458
+ </View>
459
+ </RCTScrollView>
460
+ </View>
461
+ <View
462
+ pointerEvents="box-none"
463
+ />
464
+ </View>
465
+ </View>
466
+ </View>
467
+ </View>
468
+ </View>
469
+ </View>
470
+ </View>
471
+ </RNGestureHandlerRootView>
472
+ </View>
473
+ </View>
474
+ </View>
475
+ </Modal>
476
+ `;
@@ -2,7 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { Keyboard, Platform } from 'react-native';
5
- import { render, fireEvent, waitFor } from 'test/helpers';
5
+ import { render, fireEvent } from 'test/helpers';
6
6
 
7
7
  /**
8
8
  * WordPress dependencies
@@ -53,9 +53,7 @@ describe( 'Android', () => {
53
53
  screen.getByLabelText( 'Link to, Search or type URL' )
54
54
  );
55
55
  // Await back button to allow async state updates to complete
56
- const backButton = await waitFor( () =>
57
- screen.getByLabelText( 'Go back' )
58
- );
56
+ const backButton = await screen.findByLabelText( 'Go back' );
59
57
  Keyboard.dismiss.mockClear();
60
58
  fireEvent.press( backButton );
61
59
 
@@ -63,7 +61,7 @@ describe( 'Android', () => {
63
61
  } );
64
62
 
65
63
  it( 'improves apply animation performance by dismissing keyboard beforehand', async () => {
66
- const { getByLabelText } = render(
64
+ const screen = render(
67
65
  <LinkEditSlot
68
66
  activeAttributes={ {} }
69
67
  onChange={ () => {} }
@@ -74,10 +72,12 @@ describe( 'Android', () => {
74
72
  } }
75
73
  />
76
74
  );
77
- fireEvent.press( getByLabelText( 'Link' ) );
78
- fireEvent.press( getByLabelText( 'Link to, Search or type URL' ) );
75
+ fireEvent.press( screen.getByLabelText( 'Link' ) );
76
+ fireEvent.press(
77
+ screen.getByLabelText( 'Link to, Search or type URL' )
78
+ );
79
79
  // Await back button to allow async state updates to complete
80
- const backButton = await waitFor( () => getByLabelText( 'Apply' ) );
80
+ const backButton = await screen.findByLabelText( 'Apply' );
81
81
  Keyboard.dismiss.mockClear();
82
82
  fireEvent.press( backButton );
83
83
 
@@ -112,9 +112,7 @@ describe( 'iOS', () => {
112
112
  screen.getByLabelText( 'Link to, Search or type URL' )
113
113
  );
114
114
  // Await back button to allow async state updates to complete
115
- const backButton = await waitFor( () =>
116
- screen.getByLabelText( 'Go back' )
117
- );
115
+ const backButton = await screen.findByLabelText( 'Go back' );
118
116
  Keyboard.dismiss.mockClear();
119
117
  fireEvent.press( backButton );
120
118
 
@@ -122,7 +120,7 @@ describe( 'iOS', () => {
122
120
  } );
123
121
 
124
122
  it( 'improves apply animation performance by dismissing keyboard beforehand', async () => {
125
- const { getByLabelText } = render(
123
+ const screen = render(
126
124
  <LinkEditSlot
127
125
  activeAttributes={ {} }
128
126
  onChange={ () => {} }
@@ -133,10 +131,12 @@ describe( 'iOS', () => {
133
131
  } }
134
132
  />
135
133
  );
136
- fireEvent.press( getByLabelText( 'Link' ) );
137
- fireEvent.press( getByLabelText( 'Link to, Search or type URL' ) );
134
+ fireEvent.press( screen.getByLabelText( 'Link' ) );
135
+ fireEvent.press(
136
+ screen.getByLabelText( 'Link to, Search or type URL' )
137
+ );
138
138
  // Await back button to allow async state updates to complete
139
- const backButton = await waitFor( () => getByLabelText( 'Apply' ) );
139
+ const backButton = await screen.findByLabelText( 'Apply' );
140
140
  Keyboard.dismiss.mockClear();
141
141
  fireEvent.press( backButton );
142
142
 
@@ -9,7 +9,10 @@ import { render } from 'test/helpers';
9
9
 
10
10
  describe( 'LinksUI', () => {
11
11
  it( 'LinksUI renders', () => {
12
- const screen = render( <ModalLinkUI /> );
13
- expect( screen.container ).toBeTruthy();
12
+ const value = { text: '' }; // empty `RichTextValue`
13
+ const screen = render(
14
+ <ModalLinkUI isVisible value={ value } activeAttributes={ {} } />
15
+ );
16
+ expect( screen.toJSON() ).toMatchSnapshot();
14
17
  } );
15
18
  } );