@wordpress/edit-post 6.13.1-next.957ca95e4c.0 → 6.14.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.
- package/CHANGELOG.md +2 -0
- package/build/components/block-manager/checklist.js +7 -7
- package/build/components/block-manager/checklist.js.map +1 -1
- package/build/components/sidebar/featured-image/index.js +7 -1
- package/build/components/sidebar/featured-image/index.js.map +1 -1
- package/build/components/sidebar/page-attributes/index.js +8 -1
- package/build/components/sidebar/page-attributes/index.js.map +1 -1
- package/build/components/sidebar/post-schedule/index.js +9 -5
- package/build/components/sidebar/post-schedule/index.js.map +1 -1
- package/build/components/sidebar/post-template/index.js +9 -5
- package/build/components/sidebar/post-template/index.js.map +1 -1
- package/build/components/sidebar/post-url/index.js +9 -5
- package/build/components/sidebar/post-url/index.js.map +1 -1
- package/build/components/sidebar/post-visibility/index.js +11 -8
- package/build/components/sidebar/post-visibility/index.js.map +1 -1
- package/build/components/visual-editor/index.js +4 -3
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +3 -1
- package/build/editor.js.map +1 -1
- package/build/index.js +4 -1
- package/build/index.js.map +1 -1
- package/build-module/components/block-manager/checklist.js +7 -6
- package/build-module/components/block-manager/checklist.js.map +1 -1
- package/build-module/components/sidebar/featured-image/index.js +8 -2
- package/build-module/components/sidebar/featured-image/index.js.map +1 -1
- package/build-module/components/sidebar/page-attributes/index.js +9 -2
- package/build-module/components/sidebar/page-attributes/index.js.map +1 -1
- package/build-module/components/sidebar/post-schedule/index.js +10 -6
- package/build-module/components/sidebar/post-schedule/index.js.map +1 -1
- package/build-module/components/sidebar/post-template/index.js +10 -6
- package/build-module/components/sidebar/post-template/index.js.map +1 -1
- package/build-module/components/sidebar/post-url/index.js +10 -6
- package/build-module/components/sidebar/post-url/index.js.map +1 -1
- package/build-module/components/sidebar/post-visibility/index.js +12 -9
- package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +4 -3
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +4 -2
- package/build-module/editor.js.map +1 -1
- package/build-module/index.js +4 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +9 -13
- package/build-style/style.css +9 -13
- package/package.json +27 -27
- package/src/components/block-manager/checklist.js +3 -6
- package/src/components/browser-url/test/index.js +23 -32
- package/src/components/header/test/index.js +21 -13
- package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +192 -88
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +878 -255
- package/src/components/preferences-modal/test/__snapshots__/meta-boxes-section.js.snap +394 -35
- package/src/components/preferences-modal/test/index.js +13 -7
- package/src/components/preferences-modal/test/meta-boxes-section.js +15 -9
- package/src/components/sidebar/featured-image/index.js +3 -2
- package/src/components/sidebar/page-attributes/index.js +3 -2
- package/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap +1 -1
- package/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap +1 -2
- package/src/components/sidebar/post-schedule/index.js +15 -4
- package/src/components/sidebar/post-schedule/style.scss +1 -1
- package/src/components/sidebar/post-template/index.js +11 -4
- package/src/components/sidebar/post-url/index.js +12 -4
- package/src/components/sidebar/post-visibility/index.js +19 -9
- package/src/components/visual-editor/index.js +7 -3
- package/src/editor.js +2 -2
- package/src/index.js +4 -0
- package/src/components/header/test/__snapshots__/index.js.snap +0 -31
|
@@ -1,48 +1,407 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`MetaBoxesSection renders a Custom Fields option 1`] = `
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
.emotion-0 {
|
|
5
|
+
font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
|
|
6
|
+
font-size: 13px;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.emotion-0 *,
|
|
11
|
+
.emotion-0 *::before,
|
|
12
|
+
.emotion-0 *::after {
|
|
13
|
+
box-sizing: inherit;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.components-panel__row .emotion-2 {
|
|
17
|
+
margin-bottom: inherit;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.emotion-4 {
|
|
21
|
+
display: -webkit-box;
|
|
22
|
+
display: -webkit-flex;
|
|
23
|
+
display: -ms-flexbox;
|
|
24
|
+
display: flex;
|
|
25
|
+
-webkit-align-items: center;
|
|
26
|
+
-webkit-box-align: center;
|
|
27
|
+
-ms-flex-align: center;
|
|
28
|
+
align-items: center;
|
|
29
|
+
-webkit-flex-direction: row;
|
|
30
|
+
-ms-flex-direction: row;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
gap: calc(4px * 3);
|
|
33
|
+
-webkit-box-pack: start;
|
|
34
|
+
-ms-flex-pack: start;
|
|
35
|
+
-webkit-justify-content: flex-start;
|
|
36
|
+
justify-content: flex-start;
|
|
37
|
+
width: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.emotion-4>* {
|
|
41
|
+
min-width: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
<fieldset
|
|
45
|
+
class="interface-preferences-modal__section"
|
|
6
46
|
>
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
47
|
+
<legend
|
|
48
|
+
class="interface-preferences-modal__section-legend"
|
|
49
|
+
>
|
|
50
|
+
<h2
|
|
51
|
+
class="interface-preferences-modal__section-title"
|
|
52
|
+
>
|
|
53
|
+
Advanced panels
|
|
54
|
+
</h2>
|
|
55
|
+
</legend>
|
|
56
|
+
<div
|
|
57
|
+
class="interface-preferences-modal__option"
|
|
58
|
+
>
|
|
59
|
+
<div
|
|
60
|
+
class="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
61
|
+
>
|
|
62
|
+
<div
|
|
63
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
64
|
+
>
|
|
65
|
+
<div
|
|
66
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
67
|
+
data-wp-c16t="true"
|
|
68
|
+
data-wp-component="HStack"
|
|
69
|
+
>
|
|
70
|
+
<span
|
|
71
|
+
class="components-form-toggle"
|
|
72
|
+
>
|
|
73
|
+
<input
|
|
74
|
+
class="components-form-toggle__input"
|
|
75
|
+
id="inspector-toggle-control-0"
|
|
76
|
+
type="checkbox"
|
|
77
|
+
/>
|
|
78
|
+
<span
|
|
79
|
+
class="components-form-toggle__track"
|
|
80
|
+
/>
|
|
81
|
+
<span
|
|
82
|
+
class="components-form-toggle__thumb"
|
|
83
|
+
/>
|
|
84
|
+
</span>
|
|
85
|
+
<label
|
|
86
|
+
class="components-toggle-control__label"
|
|
87
|
+
for="inspector-toggle-control-0"
|
|
88
|
+
>
|
|
89
|
+
Custom fields
|
|
90
|
+
</label>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</fieldset>
|
|
11
96
|
`;
|
|
12
97
|
|
|
13
98
|
exports[`MetaBoxesSection renders a Custom Fields option and meta box options 1`] = `
|
|
14
|
-
|
|
15
|
-
|
|
99
|
+
.emotion-0 {
|
|
100
|
+
font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
|
|
101
|
+
font-size: 13px;
|
|
102
|
+
box-sizing: border-box;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.emotion-0 *,
|
|
106
|
+
.emotion-0 *::before,
|
|
107
|
+
.emotion-0 *::after {
|
|
108
|
+
box-sizing: inherit;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.components-panel__row .emotion-2 {
|
|
112
|
+
margin-bottom: inherit;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.emotion-4 {
|
|
116
|
+
display: -webkit-box;
|
|
117
|
+
display: -webkit-flex;
|
|
118
|
+
display: -ms-flexbox;
|
|
119
|
+
display: flex;
|
|
120
|
+
-webkit-align-items: center;
|
|
121
|
+
-webkit-box-align: center;
|
|
122
|
+
-ms-flex-align: center;
|
|
123
|
+
align-items: center;
|
|
124
|
+
-webkit-flex-direction: row;
|
|
125
|
+
-ms-flex-direction: row;
|
|
126
|
+
flex-direction: row;
|
|
127
|
+
gap: calc(4px * 3);
|
|
128
|
+
-webkit-box-pack: start;
|
|
129
|
+
-ms-flex-pack: start;
|
|
130
|
+
-webkit-justify-content: flex-start;
|
|
131
|
+
justify-content: flex-start;
|
|
132
|
+
width: 100%;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.emotion-4>* {
|
|
136
|
+
min-width: 0;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
<fieldset
|
|
140
|
+
class="interface-preferences-modal__section"
|
|
16
141
|
>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
142
|
+
<legend
|
|
143
|
+
class="interface-preferences-modal__section-legend"
|
|
144
|
+
>
|
|
145
|
+
<h2
|
|
146
|
+
class="interface-preferences-modal__section-title"
|
|
147
|
+
>
|
|
148
|
+
Advanced panels
|
|
149
|
+
</h2>
|
|
150
|
+
</legend>
|
|
151
|
+
<div
|
|
152
|
+
class="interface-preferences-modal__option"
|
|
153
|
+
>
|
|
154
|
+
<div
|
|
155
|
+
class="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
156
|
+
>
|
|
157
|
+
<div
|
|
158
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
159
|
+
>
|
|
160
|
+
<div
|
|
161
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
162
|
+
data-wp-c16t="true"
|
|
163
|
+
data-wp-component="HStack"
|
|
164
|
+
>
|
|
165
|
+
<span
|
|
166
|
+
class="components-form-toggle"
|
|
167
|
+
>
|
|
168
|
+
<input
|
|
169
|
+
class="components-form-toggle__input"
|
|
170
|
+
id="inspector-toggle-control-3"
|
|
171
|
+
type="checkbox"
|
|
172
|
+
/>
|
|
173
|
+
<span
|
|
174
|
+
class="components-form-toggle__track"
|
|
175
|
+
/>
|
|
176
|
+
<span
|
|
177
|
+
class="components-form-toggle__thumb"
|
|
178
|
+
/>
|
|
179
|
+
</span>
|
|
180
|
+
<label
|
|
181
|
+
class="components-toggle-control__label"
|
|
182
|
+
for="inspector-toggle-control-3"
|
|
183
|
+
>
|
|
184
|
+
Custom fields
|
|
185
|
+
</label>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
<div
|
|
191
|
+
class="interface-preferences-modal__option"
|
|
192
|
+
>
|
|
193
|
+
<div
|
|
194
|
+
class="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
195
|
+
>
|
|
196
|
+
<div
|
|
197
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
198
|
+
>
|
|
199
|
+
<div
|
|
200
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
201
|
+
data-wp-c16t="true"
|
|
202
|
+
data-wp-component="HStack"
|
|
203
|
+
>
|
|
204
|
+
<span
|
|
205
|
+
class="components-form-toggle is-checked"
|
|
206
|
+
>
|
|
207
|
+
<input
|
|
208
|
+
checked=""
|
|
209
|
+
class="components-form-toggle__input"
|
|
210
|
+
id="inspector-toggle-control-4"
|
|
211
|
+
type="checkbox"
|
|
212
|
+
/>
|
|
213
|
+
<span
|
|
214
|
+
class="components-form-toggle__track"
|
|
215
|
+
/>
|
|
216
|
+
<span
|
|
217
|
+
class="components-form-toggle__thumb"
|
|
218
|
+
/>
|
|
219
|
+
</span>
|
|
220
|
+
<label
|
|
221
|
+
class="components-toggle-control__label"
|
|
222
|
+
for="inspector-toggle-control-4"
|
|
223
|
+
>
|
|
224
|
+
Meta Box 1
|
|
225
|
+
</label>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
<div
|
|
231
|
+
class="interface-preferences-modal__option"
|
|
232
|
+
>
|
|
233
|
+
<div
|
|
234
|
+
class="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
235
|
+
>
|
|
236
|
+
<div
|
|
237
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
238
|
+
>
|
|
239
|
+
<div
|
|
240
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
241
|
+
data-wp-c16t="true"
|
|
242
|
+
data-wp-component="HStack"
|
|
243
|
+
>
|
|
244
|
+
<span
|
|
245
|
+
class="components-form-toggle is-checked"
|
|
246
|
+
>
|
|
247
|
+
<input
|
|
248
|
+
checked=""
|
|
249
|
+
class="components-form-toggle__input"
|
|
250
|
+
id="inspector-toggle-control-5"
|
|
251
|
+
type="checkbox"
|
|
252
|
+
/>
|
|
253
|
+
<span
|
|
254
|
+
class="components-form-toggle__track"
|
|
255
|
+
/>
|
|
256
|
+
<span
|
|
257
|
+
class="components-form-toggle__thumb"
|
|
258
|
+
/>
|
|
259
|
+
</span>
|
|
260
|
+
<label
|
|
261
|
+
class="components-toggle-control__label"
|
|
262
|
+
for="inspector-toggle-control-5"
|
|
263
|
+
>
|
|
264
|
+
Meta Box 2
|
|
265
|
+
</label>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
</div>
|
|
270
|
+
</fieldset>
|
|
31
271
|
`;
|
|
32
272
|
|
|
33
273
|
exports[`MetaBoxesSection renders meta box options 1`] = `
|
|
34
|
-
|
|
35
|
-
|
|
274
|
+
.emotion-0 {
|
|
275
|
+
font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
|
|
276
|
+
font-size: 13px;
|
|
277
|
+
box-sizing: border-box;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.emotion-0 *,
|
|
281
|
+
.emotion-0 *::before,
|
|
282
|
+
.emotion-0 *::after {
|
|
283
|
+
box-sizing: inherit;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.components-panel__row .emotion-2 {
|
|
287
|
+
margin-bottom: inherit;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.emotion-4 {
|
|
291
|
+
display: -webkit-box;
|
|
292
|
+
display: -webkit-flex;
|
|
293
|
+
display: -ms-flexbox;
|
|
294
|
+
display: flex;
|
|
295
|
+
-webkit-align-items: center;
|
|
296
|
+
-webkit-box-align: center;
|
|
297
|
+
-ms-flex-align: center;
|
|
298
|
+
align-items: center;
|
|
299
|
+
-webkit-flex-direction: row;
|
|
300
|
+
-ms-flex-direction: row;
|
|
301
|
+
flex-direction: row;
|
|
302
|
+
gap: calc(4px * 3);
|
|
303
|
+
-webkit-box-pack: start;
|
|
304
|
+
-ms-flex-pack: start;
|
|
305
|
+
-webkit-justify-content: flex-start;
|
|
306
|
+
justify-content: flex-start;
|
|
307
|
+
width: 100%;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.emotion-4>* {
|
|
311
|
+
min-width: 0;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
<fieldset
|
|
315
|
+
class="interface-preferences-modal__section"
|
|
36
316
|
>
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
317
|
+
<legend
|
|
318
|
+
class="interface-preferences-modal__section-legend"
|
|
319
|
+
>
|
|
320
|
+
<h2
|
|
321
|
+
class="interface-preferences-modal__section-title"
|
|
322
|
+
>
|
|
323
|
+
Advanced panels
|
|
324
|
+
</h2>
|
|
325
|
+
</legend>
|
|
326
|
+
<div
|
|
327
|
+
class="interface-preferences-modal__option"
|
|
328
|
+
>
|
|
329
|
+
<div
|
|
330
|
+
class="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
331
|
+
>
|
|
332
|
+
<div
|
|
333
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
334
|
+
>
|
|
335
|
+
<div
|
|
336
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
337
|
+
data-wp-c16t="true"
|
|
338
|
+
data-wp-component="HStack"
|
|
339
|
+
>
|
|
340
|
+
<span
|
|
341
|
+
class="components-form-toggle is-checked"
|
|
342
|
+
>
|
|
343
|
+
<input
|
|
344
|
+
checked=""
|
|
345
|
+
class="components-form-toggle__input"
|
|
346
|
+
id="inspector-toggle-control-1"
|
|
347
|
+
type="checkbox"
|
|
348
|
+
/>
|
|
349
|
+
<span
|
|
350
|
+
class="components-form-toggle__track"
|
|
351
|
+
/>
|
|
352
|
+
<span
|
|
353
|
+
class="components-form-toggle__thumb"
|
|
354
|
+
/>
|
|
355
|
+
</span>
|
|
356
|
+
<label
|
|
357
|
+
class="components-toggle-control__label"
|
|
358
|
+
for="inspector-toggle-control-1"
|
|
359
|
+
>
|
|
360
|
+
Meta Box 1
|
|
361
|
+
</label>
|
|
362
|
+
</div>
|
|
363
|
+
</div>
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
366
|
+
<div
|
|
367
|
+
class="interface-preferences-modal__option"
|
|
368
|
+
>
|
|
369
|
+
<div
|
|
370
|
+
class="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
371
|
+
>
|
|
372
|
+
<div
|
|
373
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
374
|
+
>
|
|
375
|
+
<div
|
|
376
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
377
|
+
data-wp-c16t="true"
|
|
378
|
+
data-wp-component="HStack"
|
|
379
|
+
>
|
|
380
|
+
<span
|
|
381
|
+
class="components-form-toggle is-checked"
|
|
382
|
+
>
|
|
383
|
+
<input
|
|
384
|
+
checked=""
|
|
385
|
+
class="components-form-toggle__input"
|
|
386
|
+
id="inspector-toggle-control-2"
|
|
387
|
+
type="checkbox"
|
|
388
|
+
/>
|
|
389
|
+
<span
|
|
390
|
+
class="components-form-toggle__track"
|
|
391
|
+
/>
|
|
392
|
+
<span
|
|
393
|
+
class="components-form-toggle__thumb"
|
|
394
|
+
/>
|
|
395
|
+
</span>
|
|
396
|
+
<label
|
|
397
|
+
class="components-toggle-control__label"
|
|
398
|
+
for="inspector-toggle-control-2"
|
|
399
|
+
>
|
|
400
|
+
Meta Box 2
|
|
401
|
+
</label>
|
|
402
|
+
</div>
|
|
403
|
+
</div>
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
</fieldset>
|
|
48
407
|
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -23,20 +23,26 @@ describe( 'EditPostPreferencesModal', () => {
|
|
|
23
23
|
it( 'large viewports', () => {
|
|
24
24
|
useSelect.mockImplementation( () => true );
|
|
25
25
|
useViewportMatch.mockImplementation( () => true );
|
|
26
|
-
|
|
27
|
-
expect(
|
|
26
|
+
render( <EditPostPreferencesModal /> );
|
|
27
|
+
expect(
|
|
28
|
+
screen.getByRole( 'dialog', { name: 'Preferences' } )
|
|
29
|
+
).toMatchSnapshot();
|
|
28
30
|
} );
|
|
29
31
|
it( 'small viewports', () => {
|
|
30
32
|
useSelect.mockImplementation( () => true );
|
|
31
33
|
useViewportMatch.mockImplementation( () => false );
|
|
32
|
-
|
|
33
|
-
expect(
|
|
34
|
+
render( <EditPostPreferencesModal /> );
|
|
35
|
+
expect(
|
|
36
|
+
screen.getByRole( 'dialog', { name: 'Preferences' } )
|
|
37
|
+
).toMatchSnapshot();
|
|
34
38
|
} );
|
|
35
39
|
} );
|
|
36
40
|
|
|
37
41
|
it( 'should not render when the modal is not active', () => {
|
|
38
42
|
useSelect.mockImplementation( () => false );
|
|
39
|
-
|
|
40
|
-
expect(
|
|
43
|
+
render( <EditPostPreferencesModal /> );
|
|
44
|
+
expect(
|
|
45
|
+
screen.queryByRole( 'dialog', { name: 'Preferences' } )
|
|
46
|
+
).not.toBeInTheDocument();
|
|
41
47
|
} );
|
|
42
48
|
} );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -10,7 +10,7 @@ import { MetaBoxesSection } from '../meta-boxes-section';
|
|
|
10
10
|
|
|
11
11
|
describe( 'MetaBoxesSection', () => {
|
|
12
12
|
it( 'does not render if there are no options', () => {
|
|
13
|
-
|
|
13
|
+
render(
|
|
14
14
|
<MetaBoxesSection
|
|
15
15
|
areCustomFieldsRegistered={ false }
|
|
16
16
|
metaBoxes={ [
|
|
@@ -18,11 +18,11 @@ describe( 'MetaBoxesSection', () => {
|
|
|
18
18
|
] }
|
|
19
19
|
/>
|
|
20
20
|
);
|
|
21
|
-
expect(
|
|
21
|
+
expect( screen.queryByRole( 'group' ) ).not.toBeInTheDocument();
|
|
22
22
|
} );
|
|
23
23
|
|
|
24
24
|
it( 'renders a Custom Fields option', () => {
|
|
25
|
-
|
|
25
|
+
render(
|
|
26
26
|
<MetaBoxesSection
|
|
27
27
|
title="Advanced panels"
|
|
28
28
|
areCustomFieldsRegistered
|
|
@@ -31,11 +31,13 @@ describe( 'MetaBoxesSection', () => {
|
|
|
31
31
|
] }
|
|
32
32
|
/>
|
|
33
33
|
);
|
|
34
|
-
expect(
|
|
34
|
+
expect(
|
|
35
|
+
screen.getByRole( 'group', { name: 'Advanced panels' } )
|
|
36
|
+
).toMatchSnapshot();
|
|
35
37
|
} );
|
|
36
38
|
|
|
37
39
|
it( 'renders meta box options', () => {
|
|
38
|
-
|
|
40
|
+
render(
|
|
39
41
|
<MetaBoxesSection
|
|
40
42
|
title="Advanced panels"
|
|
41
43
|
areCustomFieldsRegistered={ false }
|
|
@@ -46,11 +48,13 @@ describe( 'MetaBoxesSection', () => {
|
|
|
46
48
|
] }
|
|
47
49
|
/>
|
|
48
50
|
);
|
|
49
|
-
expect(
|
|
51
|
+
expect(
|
|
52
|
+
screen.getByRole( 'group', { name: 'Advanced panels' } )
|
|
53
|
+
).toMatchSnapshot();
|
|
50
54
|
} );
|
|
51
55
|
|
|
52
56
|
it( 'renders a Custom Fields option and meta box options', () => {
|
|
53
|
-
|
|
57
|
+
render(
|
|
54
58
|
<MetaBoxesSection
|
|
55
59
|
title="Advanced panels"
|
|
56
60
|
areCustomFieldsRegistered
|
|
@@ -61,6 +65,8 @@ describe( 'MetaBoxesSection', () => {
|
|
|
61
65
|
] }
|
|
62
66
|
/>
|
|
63
67
|
);
|
|
64
|
-
expect(
|
|
68
|
+
expect(
|
|
69
|
+
screen.getByRole( 'group', { name: 'Advanced panels' } )
|
|
70
|
+
).toMatchSnapshot();
|
|
65
71
|
} );
|
|
66
72
|
} );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get
|
|
4
|
+
import { get } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -66,7 +66,8 @@ const applyWithDispatch = withDispatch( ( dispatch ) => {
|
|
|
66
66
|
const { toggleEditorPanelOpened } = dispatch( editPostStore );
|
|
67
67
|
|
|
68
68
|
return {
|
|
69
|
-
onTogglePanel:
|
|
69
|
+
onTogglePanel: ( ...args ) =>
|
|
70
|
+
toggleEditorPanelOpened( PANEL_NAME, ...args ),
|
|
70
71
|
};
|
|
71
72
|
} );
|
|
72
73
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get
|
|
4
|
+
import { get } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -46,7 +46,8 @@ export function PageAttributes() {
|
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const onTogglePanel =
|
|
49
|
+
const onTogglePanel = ( ...args ) =>
|
|
50
|
+
toggleEditorPanelOpened( PANEL_NAME, ...args );
|
|
50
51
|
|
|
51
52
|
return (
|
|
52
53
|
<PageAttributesCheck>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`PluginPostPublishPanel renders fill properly 1`] = `"<div class=\\"components-panel__body my-plugin-post-publish-panel is-opened\\"><h2 class=\\"components-panel__body-title\\"><button type=\\"button\\" aria-expanded=\\"true\\" class=\\"components-button components-panel__body-toggle\\"><span aria-hidden=\\"true\\"><svg
|
|
3
|
+
exports[`PluginPostPublishPanel renders fill properly 1`] = `"<div class=\\"components-panel__body my-plugin-post-publish-panel is-opened\\"><h2 class=\\"components-panel__body-title\\"><button type=\\"button\\" aria-expanded=\\"true\\" class=\\"components-button components-panel__body-toggle\\"><span aria-hidden=\\"true\\"><svg viewBox=\\"0 0 24 24\\" xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"24\\" height=\\"24\\" class=\\"components-panel__arrow\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z\\"></path></svg></span>My panel title</button></h2>My panel content</div>"`;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`PluginPrePublishPanel renders fill properly 1`] = `"<div class=\\"components-panel__body my-plugin-pre-publish-panel is-opened\\"><h2 class=\\"components-panel__body-title\\"><button type=\\"button\\" aria-expanded=\\"true\\" class=\\"components-button components-panel__body-toggle\\"><span aria-hidden=\\"true\\"><svg
|
|
4
|
-
q
|
|
3
|
+
exports[`PluginPrePublishPanel renders fill properly 1`] = `"<div class=\\"components-panel__body my-plugin-pre-publish-panel is-opened\\"><h2 class=\\"components-panel__body-title\\"><button type=\\"button\\" aria-expanded=\\"true\\" class=\\"components-button components-panel__body-toggle\\"><span aria-hidden=\\"true\\"><svg viewBox=\\"0 0 24 24\\" xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"24\\" height=\\"24\\" class=\\"components-panel__arrow\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z\\"></path></svg></span>My panel title</button></h2>My panel content</div>"`;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import { PanelRow, Dropdown, Button } from '@wordpress/components';
|
|
6
|
-
import {
|
|
6
|
+
import { useState, useMemo } from '@wordpress/element';
|
|
7
7
|
import {
|
|
8
8
|
PostSchedule as PostScheduleForm,
|
|
9
9
|
PostScheduleCheck,
|
|
@@ -11,13 +11,24 @@ import {
|
|
|
11
11
|
} from '@wordpress/editor';
|
|
12
12
|
|
|
13
13
|
export default function PostSchedule() {
|
|
14
|
-
|
|
14
|
+
// Use internal state instead of a ref to make sure that the component
|
|
15
|
+
// re-renders when the popover's anchor updates.
|
|
16
|
+
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
|
|
17
|
+
// Memoize popoverProps to avoid returning a new object every time.
|
|
18
|
+
const popoverProps = useMemo(
|
|
19
|
+
() => ( { anchor: popoverAnchor } ),
|
|
20
|
+
[ popoverAnchor ]
|
|
21
|
+
);
|
|
22
|
+
|
|
15
23
|
return (
|
|
16
24
|
<PostScheduleCheck>
|
|
17
|
-
<PanelRow
|
|
25
|
+
<PanelRow
|
|
26
|
+
className="edit-post-post-schedule"
|
|
27
|
+
ref={ setPopoverAnchor }
|
|
28
|
+
>
|
|
18
29
|
<span>{ __( 'Publish' ) }</span>
|
|
19
30
|
<Dropdown
|
|
20
|
-
popoverProps={
|
|
31
|
+
popoverProps={ popoverProps }
|
|
21
32
|
position="bottom left"
|
|
22
33
|
contentClassName="edit-post-post-schedule__dialog"
|
|
23
34
|
focusOnMount
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
white-space: normal;
|
|
16
16
|
height: auto;
|
|
17
17
|
|
|
18
|
-
// This span is added by the Popover in Tooltip when no
|
|
18
|
+
// This span is added by the Popover in Tooltip when no anchor is
|
|
19
19
|
// provided. We set its width to 0 so that it does not cause the button text
|
|
20
20
|
// to wrap to a new line when displaying the tooltip. A better fix would be
|
|
21
21
|
// to pass anchorRef and avoid the need for a span alltogether, which is
|