@wordpress/edit-post 6.16.0 → 6.17.0
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/category.js +1 -1
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/device-preview/index.js +3 -0
- package/build/components/device-preview/index.js.map +1 -1
- package/build/components/header/index.js +54 -11
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +3 -1
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +51 -2
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +43 -2
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +14 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +27 -8
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/options/enable-feature.js +6 -2
- package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build/editor.js +5 -5
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +1 -1
- package/build/editor.native.js.map +1 -1
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/block-manager/category.js +2 -2
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/device-preview/index.js +3 -0
- package/build-module/components/device-preview/index.js.map +1 -1
- package/build-module/components/header/index.js +53 -11
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +3 -1
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +49 -3
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +42 -3
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +15 -9
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +26 -8
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-feature.js +6 -2
- package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build-module/editor.js +6 -6
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +2 -2
- package/build-module/editor.native.js.map +1 -1
- package/build-module/store/actions.js +2 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +32 -0
- package/build-style/style.css +32 -0
- package/package.json +27 -27
- package/src/components/block-manager/category.js +3 -4
- package/src/components/device-preview/index.js +2 -0
- package/src/components/editor-initialization/test/listener-hooks.js +47 -49
- package/src/components/header/index.js +31 -12
- package/src/components/header/more-menu/index.js +1 -1
- package/src/components/header/style.scss +44 -0
- package/src/components/header/writing-menu/index.js +52 -3
- package/src/components/keyboard-shortcuts/index.js +49 -3
- package/src/components/layout/index.js +17 -7
- package/src/components/layout/style.scss +7 -0
- package/src/components/preferences-modal/index.js +35 -19
- package/src/components/preferences-modal/options/enable-feature.js +5 -2
- package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +128 -132
- package/src/components/preferences-modal/options/test/enable-custom-fields.js +35 -30
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +50 -55
- package/src/components/preferences-modal/test/index.js +3 -3
- package/src/components/sidebar/plugin-post-status-info/test/__snapshots__/index.js.snap +1 -1
- package/src/components/sidebar/plugin-post-status-info/test/index.js +4 -4
- package/src/editor.js +7 -8
- package/src/editor.native.js +3 -4
- package/src/store/actions.js +3 -4
- package/src/store/reducer.js +1 -1
package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap
CHANGED
|
@@ -41,58 +41,55 @@ exports[`EnableCustomFieldsOption renders a checked checkbox and a confirmation
|
|
|
41
41
|
min-width: 0;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
<div
|
|
45
|
-
className="interface-preferences-modal__option"
|
|
46
|
-
>
|
|
44
|
+
<div>
|
|
47
45
|
<div
|
|
48
|
-
|
|
46
|
+
class="interface-preferences-modal__option"
|
|
49
47
|
>
|
|
50
48
|
<div
|
|
51
|
-
|
|
49
|
+
class="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
52
50
|
>
|
|
53
51
|
<div
|
|
54
|
-
|
|
55
|
-
data-wp-c16t={true}
|
|
56
|
-
data-wp-component="HStack"
|
|
52
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
57
53
|
>
|
|
58
|
-
<
|
|
59
|
-
|
|
54
|
+
<div
|
|
55
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
56
|
+
data-wp-c16t="true"
|
|
57
|
+
data-wp-component="HStack"
|
|
60
58
|
>
|
|
61
|
-
<input
|
|
62
|
-
checked={true}
|
|
63
|
-
className="components-form-toggle__input"
|
|
64
|
-
id="inspector-toggle-control-3"
|
|
65
|
-
onChange={[Function]}
|
|
66
|
-
type="checkbox"
|
|
67
|
-
/>
|
|
68
|
-
<span
|
|
69
|
-
className="components-form-toggle__track"
|
|
70
|
-
/>
|
|
71
59
|
<span
|
|
72
|
-
|
|
60
|
+
class="components-form-toggle is-checked"
|
|
61
|
+
>
|
|
62
|
+
<input
|
|
63
|
+
class="components-form-toggle__input"
|
|
64
|
+
id="inspector-toggle-control-3"
|
|
65
|
+
type="checkbox"
|
|
66
|
+
/>
|
|
67
|
+
<span
|
|
68
|
+
class="components-form-toggle__track"
|
|
69
|
+
/>
|
|
70
|
+
<span
|
|
71
|
+
class="components-form-toggle__thumb"
|
|
72
|
+
/>
|
|
73
|
+
</span>
|
|
74
|
+
<label
|
|
75
|
+
class="components-toggle-control__label"
|
|
76
|
+
for="inspector-toggle-control-3"
|
|
73
77
|
/>
|
|
74
|
-
</
|
|
75
|
-
<label
|
|
76
|
-
className="components-toggle-control__label"
|
|
77
|
-
htmlFor="inspector-toggle-control-3"
|
|
78
|
-
/>
|
|
78
|
+
</div>
|
|
79
79
|
</div>
|
|
80
80
|
</div>
|
|
81
|
+
<p
|
|
82
|
+
class="edit-post-preferences-modal__custom-fields-confirmation-message"
|
|
83
|
+
>
|
|
84
|
+
A page reload is required for this change. Make sure your content is saved before reloading.
|
|
85
|
+
</p>
|
|
86
|
+
<button
|
|
87
|
+
class="components-button edit-post-preferences-modal__custom-fields-confirmation-button is-secondary"
|
|
88
|
+
type="button"
|
|
89
|
+
>
|
|
90
|
+
Enable & Reload
|
|
91
|
+
</button>
|
|
81
92
|
</div>
|
|
82
|
-
<p
|
|
83
|
-
className="edit-post-preferences-modal__custom-fields-confirmation-message"
|
|
84
|
-
>
|
|
85
|
-
A page reload is required for this change. Make sure your content is saved before reloading.
|
|
86
|
-
</p>
|
|
87
|
-
<button
|
|
88
|
-
aria-describedby={null}
|
|
89
|
-
className="components-button edit-post-preferences-modal__custom-fields-confirmation-button is-secondary"
|
|
90
|
-
disabled={false}
|
|
91
|
-
onClick={[Function]}
|
|
92
|
-
type="button"
|
|
93
|
-
>
|
|
94
|
-
Enable & Reload
|
|
95
|
-
</button>
|
|
96
93
|
</div>
|
|
97
94
|
`;
|
|
98
95
|
|
|
@@ -137,41 +134,42 @@ exports[`EnableCustomFieldsOption renders a checked checkbox when custom fields
|
|
|
137
134
|
min-width: 0;
|
|
138
135
|
}
|
|
139
136
|
|
|
140
|
-
<div
|
|
141
|
-
className="interface-preferences-modal__option"
|
|
142
|
-
>
|
|
137
|
+
<div>
|
|
143
138
|
<div
|
|
144
|
-
|
|
139
|
+
class="interface-preferences-modal__option"
|
|
145
140
|
>
|
|
146
141
|
<div
|
|
147
|
-
|
|
142
|
+
class="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
148
143
|
>
|
|
149
144
|
<div
|
|
150
|
-
|
|
151
|
-
data-wp-c16t={true}
|
|
152
|
-
data-wp-component="HStack"
|
|
145
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
153
146
|
>
|
|
154
|
-
<
|
|
155
|
-
|
|
147
|
+
<div
|
|
148
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
149
|
+
data-wp-c16t="true"
|
|
150
|
+
data-wp-component="HStack"
|
|
156
151
|
>
|
|
157
|
-
<input
|
|
158
|
-
checked={true}
|
|
159
|
-
className="components-form-toggle__input"
|
|
160
|
-
id="inspector-toggle-control-0"
|
|
161
|
-
onChange={[Function]}
|
|
162
|
-
type="checkbox"
|
|
163
|
-
/>
|
|
164
|
-
<span
|
|
165
|
-
className="components-form-toggle__track"
|
|
166
|
-
/>
|
|
167
152
|
<span
|
|
168
|
-
|
|
153
|
+
class="components-form-toggle is-checked"
|
|
154
|
+
>
|
|
155
|
+
<input
|
|
156
|
+
checked=""
|
|
157
|
+
class="components-form-toggle__input"
|
|
158
|
+
id="inspector-toggle-control-0"
|
|
159
|
+
type="checkbox"
|
|
160
|
+
/>
|
|
161
|
+
<span
|
|
162
|
+
class="components-form-toggle__track"
|
|
163
|
+
/>
|
|
164
|
+
<span
|
|
165
|
+
class="components-form-toggle__thumb"
|
|
166
|
+
/>
|
|
167
|
+
</span>
|
|
168
|
+
<label
|
|
169
|
+
class="components-toggle-control__label"
|
|
170
|
+
for="inspector-toggle-control-0"
|
|
169
171
|
/>
|
|
170
|
-
</
|
|
171
|
-
<label
|
|
172
|
-
className="components-toggle-control__label"
|
|
173
|
-
htmlFor="inspector-toggle-control-0"
|
|
174
|
-
/>
|
|
172
|
+
</div>
|
|
175
173
|
</div>
|
|
176
174
|
</div>
|
|
177
175
|
</div>
|
|
@@ -219,58 +217,56 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox and a confirmati
|
|
|
219
217
|
min-width: 0;
|
|
220
218
|
}
|
|
221
219
|
|
|
222
|
-
<div
|
|
223
|
-
className="interface-preferences-modal__option"
|
|
224
|
-
>
|
|
220
|
+
<div>
|
|
225
221
|
<div
|
|
226
|
-
|
|
222
|
+
class="interface-preferences-modal__option"
|
|
227
223
|
>
|
|
228
224
|
<div
|
|
229
|
-
|
|
225
|
+
class="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
230
226
|
>
|
|
231
227
|
<div
|
|
232
|
-
|
|
233
|
-
data-wp-c16t={true}
|
|
234
|
-
data-wp-component="HStack"
|
|
228
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
235
229
|
>
|
|
236
|
-
<
|
|
237
|
-
|
|
230
|
+
<div
|
|
231
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
232
|
+
data-wp-c16t="true"
|
|
233
|
+
data-wp-component="HStack"
|
|
238
234
|
>
|
|
239
|
-
<input
|
|
240
|
-
checked={false}
|
|
241
|
-
className="components-form-toggle__input"
|
|
242
|
-
id="inspector-toggle-control-2"
|
|
243
|
-
onChange={[Function]}
|
|
244
|
-
type="checkbox"
|
|
245
|
-
/>
|
|
246
|
-
<span
|
|
247
|
-
className="components-form-toggle__track"
|
|
248
|
-
/>
|
|
249
235
|
<span
|
|
250
|
-
|
|
236
|
+
class="components-form-toggle"
|
|
237
|
+
>
|
|
238
|
+
<input
|
|
239
|
+
checked=""
|
|
240
|
+
class="components-form-toggle__input"
|
|
241
|
+
id="inspector-toggle-control-2"
|
|
242
|
+
type="checkbox"
|
|
243
|
+
/>
|
|
244
|
+
<span
|
|
245
|
+
class="components-form-toggle__track"
|
|
246
|
+
/>
|
|
247
|
+
<span
|
|
248
|
+
class="components-form-toggle__thumb"
|
|
249
|
+
/>
|
|
250
|
+
</span>
|
|
251
|
+
<label
|
|
252
|
+
class="components-toggle-control__label"
|
|
253
|
+
for="inspector-toggle-control-2"
|
|
251
254
|
/>
|
|
252
|
-
</
|
|
253
|
-
<label
|
|
254
|
-
className="components-toggle-control__label"
|
|
255
|
-
htmlFor="inspector-toggle-control-2"
|
|
256
|
-
/>
|
|
255
|
+
</div>
|
|
257
256
|
</div>
|
|
258
257
|
</div>
|
|
258
|
+
<p
|
|
259
|
+
class="edit-post-preferences-modal__custom-fields-confirmation-message"
|
|
260
|
+
>
|
|
261
|
+
A page reload is required for this change. Make sure your content is saved before reloading.
|
|
262
|
+
</p>
|
|
263
|
+
<button
|
|
264
|
+
class="components-button edit-post-preferences-modal__custom-fields-confirmation-button is-secondary"
|
|
265
|
+
type="button"
|
|
266
|
+
>
|
|
267
|
+
Disable & Reload
|
|
268
|
+
</button>
|
|
259
269
|
</div>
|
|
260
|
-
<p
|
|
261
|
-
className="edit-post-preferences-modal__custom-fields-confirmation-message"
|
|
262
|
-
>
|
|
263
|
-
A page reload is required for this change. Make sure your content is saved before reloading.
|
|
264
|
-
</p>
|
|
265
|
-
<button
|
|
266
|
-
aria-describedby={null}
|
|
267
|
-
className="components-button edit-post-preferences-modal__custom-fields-confirmation-button is-secondary"
|
|
268
|
-
disabled={false}
|
|
269
|
-
onClick={[Function]}
|
|
270
|
-
type="button"
|
|
271
|
-
>
|
|
272
|
-
Disable & Reload
|
|
273
|
-
</button>
|
|
274
270
|
</div>
|
|
275
271
|
`;
|
|
276
272
|
|
|
@@ -315,41 +311,41 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox when custom fiel
|
|
|
315
311
|
min-width: 0;
|
|
316
312
|
}
|
|
317
313
|
|
|
318
|
-
<div
|
|
319
|
-
className="interface-preferences-modal__option"
|
|
320
|
-
>
|
|
314
|
+
<div>
|
|
321
315
|
<div
|
|
322
|
-
|
|
316
|
+
class="interface-preferences-modal__option"
|
|
323
317
|
>
|
|
324
318
|
<div
|
|
325
|
-
|
|
319
|
+
class="components-base-control components-toggle-control emotion-0 emotion-1"
|
|
326
320
|
>
|
|
327
321
|
<div
|
|
328
|
-
|
|
329
|
-
data-wp-c16t={true}
|
|
330
|
-
data-wp-component="HStack"
|
|
322
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
331
323
|
>
|
|
332
|
-
<
|
|
333
|
-
|
|
324
|
+
<div
|
|
325
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
326
|
+
data-wp-c16t="true"
|
|
327
|
+
data-wp-component="HStack"
|
|
334
328
|
>
|
|
335
|
-
<input
|
|
336
|
-
checked={false}
|
|
337
|
-
className="components-form-toggle__input"
|
|
338
|
-
id="inspector-toggle-control-1"
|
|
339
|
-
onChange={[Function]}
|
|
340
|
-
type="checkbox"
|
|
341
|
-
/>
|
|
342
|
-
<span
|
|
343
|
-
className="components-form-toggle__track"
|
|
344
|
-
/>
|
|
345
329
|
<span
|
|
346
|
-
|
|
330
|
+
class="components-form-toggle"
|
|
331
|
+
>
|
|
332
|
+
<input
|
|
333
|
+
class="components-form-toggle__input"
|
|
334
|
+
id="inspector-toggle-control-1"
|
|
335
|
+
type="checkbox"
|
|
336
|
+
/>
|
|
337
|
+
<span
|
|
338
|
+
class="components-form-toggle__track"
|
|
339
|
+
/>
|
|
340
|
+
<span
|
|
341
|
+
class="components-form-toggle__thumb"
|
|
342
|
+
/>
|
|
343
|
+
</span>
|
|
344
|
+
<label
|
|
345
|
+
class="components-toggle-control__label"
|
|
346
|
+
for="inspector-toggle-control-1"
|
|
347
347
|
/>
|
|
348
|
-
</
|
|
349
|
-
<label
|
|
350
|
-
className="components-toggle-control__label"
|
|
351
|
-
htmlFor="inspector-toggle-control-1"
|
|
352
|
-
/>
|
|
348
|
+
</div>
|
|
353
349
|
</div>
|
|
354
350
|
</div>
|
|
355
351
|
</div>
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { Button } from '@wordpress/components';
|
|
10
|
-
import { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
import userEvent from '@testing-library/user-event';
|
|
11
6
|
|
|
12
7
|
/**
|
|
13
8
|
* Internal dependencies
|
|
@@ -19,42 +14,55 @@ import {
|
|
|
19
14
|
|
|
20
15
|
describe( 'EnableCustomFieldsOption', () => {
|
|
21
16
|
it( 'renders a checked checkbox when custom fields are enabled', () => {
|
|
22
|
-
const
|
|
17
|
+
const { container } = render(
|
|
23
18
|
<EnableCustomFieldsOption areCustomFieldsEnabled />
|
|
24
19
|
);
|
|
25
|
-
|
|
20
|
+
|
|
21
|
+
expect( container ).toMatchSnapshot();
|
|
26
22
|
} );
|
|
27
23
|
|
|
28
24
|
it( 'renders an unchecked checkbox when custom fields are disabled', () => {
|
|
29
|
-
const
|
|
25
|
+
const { container } = render(
|
|
30
26
|
<EnableCustomFieldsOption areCustomFieldsEnabled={ false } />
|
|
31
27
|
);
|
|
32
|
-
|
|
28
|
+
|
|
29
|
+
expect( container ).toMatchSnapshot();
|
|
33
30
|
} );
|
|
34
31
|
|
|
35
|
-
it( 'renders an unchecked checkbox and a confirmation message when toggled off', () => {
|
|
36
|
-
const
|
|
32
|
+
it( 'renders an unchecked checkbox and a confirmation message when toggled off', async () => {
|
|
33
|
+
const user = userEvent.setup( {
|
|
34
|
+
advanceTimers: jest.advanceTimersByTime,
|
|
35
|
+
} );
|
|
36
|
+
|
|
37
|
+
const { container } = render(
|
|
37
38
|
<EnableCustomFieldsOption areCustomFieldsEnabled />
|
|
38
39
|
);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
expect(
|
|
40
|
+
|
|
41
|
+
await user.click( screen.getByRole( 'checkbox' ) );
|
|
42
|
+
|
|
43
|
+
expect( container ).toMatchSnapshot();
|
|
43
44
|
} );
|
|
44
45
|
|
|
45
|
-
it( 'renders a checked checkbox and a confirmation message when toggled on', () => {
|
|
46
|
-
const
|
|
46
|
+
it( 'renders a checked checkbox and a confirmation message when toggled on', async () => {
|
|
47
|
+
const user = userEvent.setup( {
|
|
48
|
+
advanceTimers: jest.advanceTimersByTime,
|
|
49
|
+
} );
|
|
50
|
+
|
|
51
|
+
const { container } = render(
|
|
47
52
|
<EnableCustomFieldsOption areCustomFieldsEnabled={ false } />
|
|
48
53
|
);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
expect(
|
|
54
|
+
|
|
55
|
+
await user.click( screen.getByRole( 'checkbox' ) );
|
|
56
|
+
|
|
57
|
+
expect( container ).toMatchSnapshot();
|
|
53
58
|
} );
|
|
54
59
|
} );
|
|
55
60
|
|
|
56
61
|
describe( 'CustomFieldsConfirmation', () => {
|
|
57
|
-
it( 'submits the toggle-custom-fields-form', () => {
|
|
62
|
+
it( 'submits the toggle-custom-fields-form', async () => {
|
|
63
|
+
const user = userEvent.setup( {
|
|
64
|
+
advanceTimers: jest.advanceTimersByTime,
|
|
65
|
+
} );
|
|
58
66
|
const submit = jest.fn();
|
|
59
67
|
const getElementById = jest
|
|
60
68
|
.spyOn( document, 'getElementById' )
|
|
@@ -62,12 +70,9 @@ describe( 'CustomFieldsConfirmation', () => {
|
|
|
62
70
|
submit,
|
|
63
71
|
} ) );
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
);
|
|
68
|
-
act( () => {
|
|
69
|
-
renderer.root.findByType( Button ).props.onClick();
|
|
70
|
-
} );
|
|
73
|
+
render( <CustomFieldsConfirmation /> );
|
|
74
|
+
|
|
75
|
+
await user.click( screen.getByRole( 'button' ) );
|
|
71
76
|
|
|
72
77
|
expect( getElementById ).toHaveBeenCalledWith(
|
|
73
78
|
'toggle-custom-fields-form'
|