@wordpress/e2e-tests 7.16.0 → 7.18.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 +4 -0
- package/package.json +8 -7
- package/plugins/block-icons/index.js +1 -1
- package/plugins/dataviews.php +25 -0
- package/plugins/interactive-blocks/directive-bind/render.php +3 -1
- package/plugins/interactive-blocks/directive-bind/view.js +32 -29
- package/plugins/interactive-blocks/directive-body/render.php +3 -1
- package/plugins/interactive-blocks/directive-body/view.js +11 -9
- package/plugins/interactive-blocks/directive-class/render.php +3 -1
- package/plugins/interactive-blocks/directive-class/view.js +20 -18
- package/plugins/interactive-blocks/directive-context/render.php +6 -4
- package/plugins/interactive-blocks/directive-context/view.js +49 -40
- package/plugins/interactive-blocks/directive-init/render.php +8 -6
- package/plugins/interactive-blocks/directive-init/view.js +59 -60
- package/plugins/interactive-blocks/directive-key/render.php +5 -1
- package/plugins/interactive-blocks/directive-key/view.js +18 -14
- package/plugins/interactive-blocks/directive-on/render.php +3 -1
- package/plugins/interactive-blocks/directive-on/view.js +27 -24
- package/plugins/interactive-blocks/directive-priorities/render.php +7 -2
- package/plugins/interactive-blocks/directive-priorities/view.js +107 -111
- package/plugins/interactive-blocks/directive-slots/render.php +3 -1
- package/plugins/interactive-blocks/directive-slots/view.js +17 -15
- package/plugins/interactive-blocks/directive-style/render.php +2 -1
- package/plugins/interactive-blocks/directive-style/view.js +21 -19
- package/plugins/interactive-blocks/directive-text/render.php +3 -1
- package/plugins/interactive-blocks/directive-text/view.js +16 -14
- package/plugins/interactive-blocks/{store-afterload → directive-watch}/block.json +3 -3
- package/plugins/interactive-blocks/{directive-effect → directive-watch}/render.php +8 -6
- package/plugins/interactive-blocks/directive-watch/view.js +53 -0
- package/plugins/interactive-blocks/negation-operator/render.php +4 -2
- package/plugins/interactive-blocks/negation-operator/view.js +15 -19
- package/plugins/interactive-blocks/router-navigate/render.php +11 -8
- package/plugins/interactive-blocks/router-navigate/view.js +27 -34
- package/plugins/interactive-blocks/router-regions/render.php +13 -3
- package/plugins/interactive-blocks/router-regions/view.js +37 -35
- package/plugins/interactive-blocks/store-tag/render.php +7 -4
- package/plugins/interactive-blocks/store-tag/view.js +19 -19
- package/plugins/interactive-blocks/tovdom/render.php +3 -1
- package/plugins/interactive-blocks/tovdom/view.js +5 -4
- package/plugins/interactive-blocks/tovdom-islands/render.php +11 -6
- package/plugins/interactive-blocks/tovdom-islands/view.js +24 -23
- package/plugins/interactive-blocks.php +4 -4
- package/specs/editor/various/datepicker.test.js +8 -8
- package/specs/editor/various/pattern-blocks.test.js +4 -4
- package/specs/editor/various/scheduling.test.js +1 -1
- package/plugins/interactive-blocks/directive-effect/block.json +0 -14
- package/plugins/interactive-blocks/directive-effect/view.js +0 -59
- package/plugins/interactive-blocks/store-afterload/render.php +0 -41
- package/plugins/interactive-blocks/store-afterload/view.js +0 -60
- package/specs/editor/plugins/__snapshots__/align-hook.test.js.snap +0 -43
- package/specs/editor/plugins/__snapshots__/block-directory-add.test.js.snap +0 -3
- package/specs/editor/plugins/__snapshots__/container-blocks.test.js.snap +0 -58
- package/specs/editor/plugins/__snapshots__/cpt-locking.test.js.snap +0 -147
- package/specs/editor/plugins/__snapshots__/inner-blocks-render-appender.test.js.snap +0 -25
- package/specs/editor/plugins/__snapshots__/meta-attribute-block.test.js.snap +0 -9
- package/specs/editor/plugins/__snapshots__/plugins-api.test.js.snap +0 -7
- package/specs/editor/plugins/align-hook.test.js +0 -234
- package/specs/editor/plugins/annotations.test.js +0 -189
- package/specs/editor/plugins/block-directory-add.test.js +0 -205
- package/specs/editor/plugins/block-icons.test.js +0 -170
- package/specs/editor/plugins/child-blocks.test.js +0 -66
- package/specs/editor/plugins/container-blocks.test.js +0 -130
- package/specs/editor/plugins/cpt-locking.test.js +0 -251
- package/specs/editor/plugins/custom-taxonomies.test.js +0 -61
- package/specs/editor/plugins/inner-blocks-prioritized-inserter-blocks.test.js +0 -132
- package/specs/editor/plugins/inner-blocks-render-appender.test.js +0 -126
- package/specs/editor/plugins/meta-attribute-block.test.js +0 -100
- package/specs/editor/plugins/meta-boxes.test.js +0 -137
- package/specs/editor/plugins/plugins-api.test.js +0 -189
- package/specs/editor/various/is-typing.test.js +0 -101
- package/specs/editor/various/publish-button.test.js +0 -46
- package/specs/editor/various/sidebar-permalink.test.js +0 -53
@@ -1,41 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
/**
|
3
|
-
* HTML for testing `afterLoad` callbacks added to the store.
|
4
|
-
*
|
5
|
-
* @package gutenberg-test-interactive-blocks
|
6
|
-
*/
|
7
|
-
|
8
|
-
?>
|
9
|
-
<div data-wp-interactive>
|
10
|
-
<h3>Store statuses</h3>
|
11
|
-
<p data-store-status data-wp-text="state.status1">waiting</p>
|
12
|
-
<p data-store-status data-wp-text="state.status2">waiting</p>
|
13
|
-
<p data-store-status data-wp-text="state.status3">waiting</p>
|
14
|
-
<p data-store-status data-wp-text="state.status4">waiting</p>
|
15
|
-
|
16
|
-
<h3><code>afterLoad</code> executions</h3>
|
17
|
-
<p>All stores ready:
|
18
|
-
<span
|
19
|
-
data-testid="all-stores-ready"
|
20
|
-
data-wp-text="state.allStoresReady">
|
21
|
-
>waiting</span>
|
22
|
-
</p>
|
23
|
-
<p>vDOM ready:
|
24
|
-
<span
|
25
|
-
data-testid="vdom-ready"
|
26
|
-
data-wp-text="state.vdomReady">
|
27
|
-
>waiting</span>
|
28
|
-
</p>
|
29
|
-
<p><code>afterLoad</code> exec times:
|
30
|
-
<span
|
31
|
-
data-testid="after-load-exec-times"
|
32
|
-
data-wp-text="state.execTimes.afterLoad">
|
33
|
-
>0</span>
|
34
|
-
</p>
|
35
|
-
<p><code>sharedAfterLoad</code> exec times:
|
36
|
-
<span
|
37
|
-
data-testid="shared-after-load-exec-times"
|
38
|
-
data-wp-text="state.execTimes.sharedAfterLoad">
|
39
|
-
>0</span>
|
40
|
-
</p>
|
41
|
-
</div>
|
@@ -1,60 +0,0 @@
|
|
1
|
-
( ( { wp } ) => {
|
2
|
-
/**
|
3
|
-
* WordPress dependencies
|
4
|
-
*/
|
5
|
-
const { store } = wp.interactivity;
|
6
|
-
|
7
|
-
const afterLoad = ({ state }) => {
|
8
|
-
// Check the state is correctly initialized.
|
9
|
-
const { status1, status2, status3, status4 } = state;
|
10
|
-
state.allStoresReady =
|
11
|
-
[ status1, status2, status3, status4 ]
|
12
|
-
.every( ( t ) => t === 'ready' )
|
13
|
-
.toString();
|
14
|
-
|
15
|
-
// Check the HTML has been processed as well.
|
16
|
-
const selector = '[data-store-status]';
|
17
|
-
state.vdomReady =
|
18
|
-
document.querySelector( selector ) &&
|
19
|
-
Array.from(
|
20
|
-
document.querySelectorAll( selector )
|
21
|
-
).every( ( el ) => el.textContent === 'ready' ).toString();
|
22
|
-
|
23
|
-
// Increment exec times everytime this function runs.
|
24
|
-
state.execTimes.afterLoad += 1;
|
25
|
-
}
|
26
|
-
|
27
|
-
const sharedAfterLoad = ({ state }) => {
|
28
|
-
// Increment exec times everytime this function runs.
|
29
|
-
state.execTimes.sharedAfterLoad += 1;
|
30
|
-
}
|
31
|
-
|
32
|
-
// Case 1: without afterload callback
|
33
|
-
store( {
|
34
|
-
state: { status1: 'ready' },
|
35
|
-
} );
|
36
|
-
|
37
|
-
// Case 2: non-shared afterload callback
|
38
|
-
store( {
|
39
|
-
state: {
|
40
|
-
status2: 'ready',
|
41
|
-
allStoresReady: false,
|
42
|
-
vdomReady: false,
|
43
|
-
execTimes: { afterLoad: 0 },
|
44
|
-
},
|
45
|
-
}, { afterLoad } );
|
46
|
-
|
47
|
-
// Case 3: shared afterload callback
|
48
|
-
store( {
|
49
|
-
state: {
|
50
|
-
status3: 'ready',
|
51
|
-
execTimes: { sharedAfterLoad: 0 },
|
52
|
-
},
|
53
|
-
}, { afterLoad: sharedAfterLoad } );
|
54
|
-
store( {
|
55
|
-
state: {
|
56
|
-
status4: 'ready',
|
57
|
-
execTimes: { sharedAfterLoad: 0 },
|
58
|
-
},
|
59
|
-
}, { afterLoad: sharedAfterLoad } );
|
60
|
-
} )( window );
|
@@ -1,43 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`Align Hook Works As Expected Block with align array Correctly applies the selected alignment and correctly removes the alignment 1`] = `
|
4
|
-
"<!-- wp:test/test-align-array {"align":"center"} -->
|
5
|
-
<div style="outline:1px solid gray;padding:5px" class="wp-block-test-test-align-array aligncenter">Test Align Hook</div>
|
6
|
-
<!-- /wp:test/test-align-array -->"
|
7
|
-
`;
|
8
|
-
|
9
|
-
exports[`Align Hook Works As Expected Block with align array Correctly applies the selected alignment and correctly removes the alignment 2`] = `
|
10
|
-
"<!-- wp:test/test-align-array -->
|
11
|
-
<div style="outline:1px solid gray;padding:5px" class="wp-block-test-test-align-array">Test Align Hook</div>
|
12
|
-
<!-- /wp:test/test-align-array -->"
|
13
|
-
`;
|
14
|
-
|
15
|
-
exports[`Align Hook Works As Expected Block with align true Correctly applies the selected alignment and correctly removes the alignment 1`] = `
|
16
|
-
"<!-- wp:test/test-align-true {"align":"right"} -->
|
17
|
-
<div style="outline:1px solid gray;padding:5px" class="wp-block-test-test-align-true alignright">Test Align Hook</div>
|
18
|
-
<!-- /wp:test/test-align-true -->"
|
19
|
-
`;
|
20
|
-
|
21
|
-
exports[`Align Hook Works As Expected Block with align true Correctly applies the selected alignment and correctly removes the alignment 2`] = `
|
22
|
-
"<!-- wp:test/test-align-true -->
|
23
|
-
<div style="outline:1px solid gray;padding:5px" class="wp-block-test-test-align-true">Test Align Hook</div>
|
24
|
-
<!-- /wp:test/test-align-true -->"
|
25
|
-
`;
|
26
|
-
|
27
|
-
exports[`Align Hook Works As Expected Block with default align Correctly applies the selected alignment and correctly removes the alignment 1`] = `
|
28
|
-
"<!-- wp:test/test-default-align {"align":"center"} -->
|
29
|
-
<div style="outline:1px solid gray;padding:5px" class="wp-block-test-test-default-align aligncenter">Test Align Hook</div>
|
30
|
-
<!-- /wp:test/test-default-align -->"
|
31
|
-
`;
|
32
|
-
|
33
|
-
exports[`Align Hook Works As Expected Block with default align Correctly applies the selected alignment and correctly removes the alignment 2`] = `
|
34
|
-
"<!-- wp:test/test-default-align {"align":""} -->
|
35
|
-
<div style="outline:1px solid gray;padding:5px" class="wp-block-test-test-default-align">Test Align Hook</div>
|
36
|
-
<!-- /wp:test/test-default-align -->"
|
37
|
-
`;
|
38
|
-
|
39
|
-
exports[`Align Hook Works As Expected Block with no alignment set Does not save any alignment related attribute or class 1`] = `
|
40
|
-
"<!-- wp:test/test-no-alignment-set -->
|
41
|
-
<div style="outline:1px solid gray;padding:5px" class="wp-block-test-test-no-alignment-set">Test Align Hook</div>
|
42
|
-
<!-- /wp:test/test-no-alignment-set -->"
|
43
|
-
`;
|
@@ -1,58 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`Container block without paragraph support ensures we can use the alternative block appender properly 1`] = `
|
4
|
-
"<!-- wp:test/container-without-paragraph -->
|
5
|
-
<!-- wp:image -->
|
6
|
-
<figure class="wp-block-image"><img alt=""/></figure>
|
7
|
-
<!-- /wp:image -->
|
8
|
-
<!-- /wp:test/container-without-paragraph -->"
|
9
|
-
`;
|
10
|
-
|
11
|
-
exports[`InnerBlocks Template Sync Ensure inner block writing flow works as expected without additional paragraphs added 1`] = `
|
12
|
-
"<!-- wp:test/test-inner-blocks-paragraph-placeholder -->
|
13
|
-
<!-- wp:paragraph {"placeholder":"Content…","fontSize":"large"} -->
|
14
|
-
<p class="has-large-font-size">Test Paragraph</p>
|
15
|
-
<!-- /wp:paragraph -->
|
16
|
-
<!-- /wp:test/test-inner-blocks-paragraph-placeholder -->"
|
17
|
-
`;
|
18
|
-
|
19
|
-
exports[`InnerBlocks Template Sync Ensures blocks without locking are kept intact even if they do not match the template 1`] = `
|
20
|
-
"<!-- wp:test/test-inner-blocks-no-locking -->
|
21
|
-
<!-- wp:paragraph {"fontSize":"large"} -->
|
22
|
-
<p class="has-large-font-size">Content…</p>
|
23
|
-
<!-- /wp:paragraph -->
|
24
|
-
|
25
|
-
<!-- wp:paragraph -->
|
26
|
-
<p>added paragraph</p>
|
27
|
-
<!-- /wp:paragraph -->
|
28
|
-
<!-- /wp:test/test-inner-blocks-no-locking -->
|
29
|
-
"
|
30
|
-
`;
|
31
|
-
|
32
|
-
exports[`InnerBlocks Template Sync Removes blocks that are not expected by the template if a lock all exists 1`] = `
|
33
|
-
"<!-- wp:test/test-inner-blocks-locking-all -->
|
34
|
-
<!-- wp:paragraph {"fontSize":"large"} -->
|
35
|
-
<p class="has-large-font-size">Content…</p>
|
36
|
-
<!-- /wp:paragraph -->
|
37
|
-
<!-- /wp:test/test-inner-blocks-locking-all -->"
|
38
|
-
`;
|
39
|
-
|
40
|
-
exports[`InnerBlocks Template Sync Synchronizes blocks if lock 'all' is set and the template prop is changed 1`] = `
|
41
|
-
"<!-- wp:test/test-inner-blocks-update-locked-template -->
|
42
|
-
<!-- wp:paragraph {"fontSize":"large"} -->
|
43
|
-
<p class="has-large-font-size">Content…</p>
|
44
|
-
<!-- /wp:paragraph -->
|
45
|
-
<!-- /wp:test/test-inner-blocks-update-locked-template -->"
|
46
|
-
`;
|
47
|
-
|
48
|
-
exports[`InnerBlocks Template Sync Synchronizes blocks if lock 'all' is set and the template prop is changed 2`] = `
|
49
|
-
"<!-- wp:test/test-inner-blocks-update-locked-template {"hasUpdatedTemplate":true} -->
|
50
|
-
<!-- wp:paragraph {"fontSize":"large"} -->
|
51
|
-
<p class="has-large-font-size">Content…</p>
|
52
|
-
<!-- /wp:paragraph -->
|
53
|
-
|
54
|
-
<!-- wp:paragraph {"fontSize":"large"} -->
|
55
|
-
<p class="has-large-font-size">Two</p>
|
56
|
-
<!-- /wp:paragraph -->
|
57
|
-
<!-- /wp:test/test-inner-blocks-update-locked-template -->"
|
58
|
-
`;
|
@@ -1,147 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`cpt locking template_lock all should insert line breaks when using enter and shift-enter 1`] = `
|
4
|
-
"<!-- wp:image -->
|
5
|
-
<figure class="wp-block-image"><img alt=""/></figure>
|
6
|
-
<!-- /wp:image -->
|
7
|
-
|
8
|
-
<!-- wp:paragraph {"placeholder":"Add a description"} -->
|
9
|
-
<p>First line<br>Second line<br>Third line</p>
|
10
|
-
<!-- /wp:paragraph -->
|
11
|
-
|
12
|
-
<!-- wp:quote -->
|
13
|
-
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
14
|
-
<p></p>
|
15
|
-
<!-- /wp:paragraph --></blockquote>
|
16
|
-
<!-- /wp:quote -->
|
17
|
-
|
18
|
-
<!-- wp:columns -->
|
19
|
-
<div class="wp-block-columns"></div>
|
20
|
-
<!-- /wp:columns -->"
|
21
|
-
`;
|
22
|
-
|
23
|
-
exports[`cpt locking template_lock all should not error when deleting the cotents of a paragraph 1`] = `
|
24
|
-
"<!-- wp:image -->
|
25
|
-
<figure class="wp-block-image"><img alt=""/></figure>
|
26
|
-
<!-- /wp:image -->
|
27
|
-
|
28
|
-
<!-- wp:paragraph {"placeholder":"Add a description"} -->
|
29
|
-
<p></p>
|
30
|
-
<!-- /wp:paragraph -->
|
31
|
-
|
32
|
-
<!-- wp:quote -->
|
33
|
-
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
34
|
-
<p></p>
|
35
|
-
<!-- /wp:paragraph --></blockquote>
|
36
|
-
<!-- /wp:quote -->
|
37
|
-
|
38
|
-
<!-- wp:columns -->
|
39
|
-
<div class="wp-block-columns"></div>
|
40
|
-
<!-- /wp:columns -->"
|
41
|
-
`;
|
42
|
-
|
43
|
-
exports[`cpt locking template_lock all unlocked group should allow blocks to be moved 1`] = `
|
44
|
-
"<!-- wp:group {"templateLock":false} -->
|
45
|
-
<div class="wp-block-group"><!-- wp:paragraph {"placeholder":"Add a description"} -->
|
46
|
-
<p>p1</p>
|
47
|
-
<!-- /wp:paragraph -->
|
48
|
-
|
49
|
-
<!-- wp:quote -->
|
50
|
-
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
51
|
-
<p></p>
|
52
|
-
<!-- /wp:paragraph --></blockquote>
|
53
|
-
<!-- /wp:quote --></div>
|
54
|
-
<!-- /wp:group -->"
|
55
|
-
`;
|
56
|
-
|
57
|
-
exports[`cpt locking template_lock all unlocked group should allow blocks to be removed 1`] = `
|
58
|
-
"<!-- wp:group {"templateLock":false} -->
|
59
|
-
<div class="wp-block-group"><!-- wp:quote -->
|
60
|
-
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
61
|
-
<p></p>
|
62
|
-
<!-- /wp:paragraph --></blockquote>
|
63
|
-
<!-- /wp:quote --></div>
|
64
|
-
<!-- /wp:group -->"
|
65
|
-
`;
|
66
|
-
|
67
|
-
exports[`cpt locking template_lock false should allow blocks to be inserted 1`] = `
|
68
|
-
"<!-- wp:image -->
|
69
|
-
<figure class="wp-block-image"><img alt=""/></figure>
|
70
|
-
<!-- /wp:image -->
|
71
|
-
|
72
|
-
<!-- wp:paragraph {"placeholder":"Add a description"} -->
|
73
|
-
<p></p>
|
74
|
-
<!-- /wp:paragraph -->
|
75
|
-
|
76
|
-
<!-- wp:quote -->
|
77
|
-
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
78
|
-
<p></p>
|
79
|
-
<!-- /wp:paragraph --></blockquote>
|
80
|
-
<!-- /wp:quote -->
|
81
|
-
|
82
|
-
<!-- wp:columns -->
|
83
|
-
<div class="wp-block-columns"></div>
|
84
|
-
<!-- /wp:columns -->
|
85
|
-
|
86
|
-
<!-- wp:list -->
|
87
|
-
<ul><!-- wp:list-item -->
|
88
|
-
<li>List content</li>
|
89
|
-
<!-- /wp:list-item --></ul>
|
90
|
-
<!-- /wp:list -->"
|
91
|
-
`;
|
92
|
-
|
93
|
-
exports[`cpt locking template_lock false should allow blocks to be moved 1`] = `
|
94
|
-
"<!-- wp:paragraph {"placeholder":"Add a description"} -->
|
95
|
-
<p>p1</p>
|
96
|
-
<!-- /wp:paragraph -->
|
97
|
-
|
98
|
-
<!-- wp:image -->
|
99
|
-
<figure class="wp-block-image"><img alt=""/></figure>
|
100
|
-
<!-- /wp:image -->
|
101
|
-
|
102
|
-
<!-- wp:quote -->
|
103
|
-
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
104
|
-
<p></p>
|
105
|
-
<!-- /wp:paragraph --></blockquote>
|
106
|
-
<!-- /wp:quote -->
|
107
|
-
|
108
|
-
<!-- wp:columns -->
|
109
|
-
<div class="wp-block-columns"></div>
|
110
|
-
<!-- /wp:columns -->"
|
111
|
-
`;
|
112
|
-
|
113
|
-
exports[`cpt locking template_lock false should allow blocks to be removed 1`] = `
|
114
|
-
"<!-- wp:image -->
|
115
|
-
<figure class="wp-block-image"><img alt=""/></figure>
|
116
|
-
<!-- /wp:image -->
|
117
|
-
|
118
|
-
<!-- wp:quote -->
|
119
|
-
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
120
|
-
<p></p>
|
121
|
-
<!-- /wp:paragraph --></blockquote>
|
122
|
-
<!-- /wp:quote -->
|
123
|
-
|
124
|
-
<!-- wp:columns -->
|
125
|
-
<div class="wp-block-columns"></div>
|
126
|
-
<!-- /wp:columns -->"
|
127
|
-
`;
|
128
|
-
|
129
|
-
exports[`cpt locking template_lock insert should allow blocks to be moved 1`] = `
|
130
|
-
"<!-- wp:paragraph {"placeholder":"Add a description"} -->
|
131
|
-
<p>p1</p>
|
132
|
-
<!-- /wp:paragraph -->
|
133
|
-
|
134
|
-
<!-- wp:image -->
|
135
|
-
<figure class="wp-block-image"><img alt=""/></figure>
|
136
|
-
<!-- /wp:image -->
|
137
|
-
|
138
|
-
<!-- wp:quote -->
|
139
|
-
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
140
|
-
<p></p>
|
141
|
-
<!-- /wp:paragraph --></blockquote>
|
142
|
-
<!-- /wp:quote -->
|
143
|
-
|
144
|
-
<!-- wp:columns -->
|
145
|
-
<div class="wp-block-columns"></div>
|
146
|
-
<!-- /wp:columns -->"
|
147
|
-
`;
|
@@ -1,25 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`RenderAppender prop of InnerBlocks Users can customize the appender and can still insert blocks using exposed components 1`] = `
|
4
|
-
"<!-- wp:test/inner-blocks-render-appender -->
|
5
|
-
<div style="outline:1px solid gray;padding:5px" class="wp-block-test-inner-blocks-render-appender"><!-- wp:quote -->
|
6
|
-
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
7
|
-
<p></p>
|
8
|
-
<!-- /wp:paragraph --></blockquote>
|
9
|
-
<!-- /wp:quote --></div>
|
10
|
-
<!-- /wp:test/inner-blocks-render-appender -->"
|
11
|
-
`;
|
12
|
-
|
13
|
-
exports[`RenderAppender prop of InnerBlocks Users can dynamically customize the appender 1`] = `
|
14
|
-
"<!-- wp:test/inner-blocks-render-appender-dynamic -->
|
15
|
-
<div style="outline:1px solid gray;padding:5px" class="wp-block-test-inner-blocks-render-appender-dynamic"><!-- wp:quote -->
|
16
|
-
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
17
|
-
<p></p>
|
18
|
-
<!-- /wp:paragraph --></blockquote>
|
19
|
-
<!-- /wp:quote -->
|
20
|
-
|
21
|
-
<!-- wp:video -->
|
22
|
-
<figure class="wp-block-video"></figure>
|
23
|
-
<!-- /wp:video --></div>
|
24
|
-
<!-- /wp:test/inner-blocks-render-appender-dynamic -->"
|
25
|
-
`;
|
@@ -1,9 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`Block with a meta attribute Early Registration Should persist the meta attribute properly 1`] = `"<!-- wp:test/test-meta-attribute-block-early /-->"`;
|
4
|
-
|
5
|
-
exports[`Block with a meta attribute Early Registration Should persist the meta attribute properly in a different post type 1`] = `"<!-- wp:test/test-meta-attribute-block-early /-->"`;
|
6
|
-
|
7
|
-
exports[`Block with a meta attribute Late Registration Should persist the meta attribute properly 1`] = `"<!-- wp:test/test-meta-attribute-block-late /-->"`;
|
8
|
-
|
9
|
-
exports[`Block with a meta attribute Late Registration Should persist the meta attribute properly in a different post type 1`] = `"<!-- wp:test/test-meta-attribute-block-late /-->"`;
|
@@ -1,7 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`Using Plugins API Document Setting Custom Panel Should render a custom panel inside Document Setting sidebar 1`] = `"My Custom Panel"`;
|
4
|
-
|
5
|
-
exports[`Using Plugins API Sidebar Medium screen Should open plugins sidebar using More Menu item and render content 1`] = `"<div class="components-panel__header interface-complementary-area-header__small"><span class="interface-complementary-area-header__small-title">(no title)</span><button type="button" aria-controls="my-sidebar-plugin:title-sidebar" class="components-button has-icon" aria-label="Close plugin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg></button></div><div class="components-panel__header interface-complementary-area-header" tabindex="-1"><strong>Plugin title</strong><button type="button" aria-pressed="true" aria-expanded="true" class="components-button interface-complementary-area__pin-unpin-item is-pressed has-icon" aria-label="Unpin from toolbar"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"></path></svg></button><button type="button" aria-controls="my-sidebar-plugin:title-sidebar" class="components-button has-icon" aria-label="Close plugin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg></button></div><div class="components-panel"><div class="components-panel__body sidebar-title-plugin-panel is-opened"><div class="components-panel__row"><label for="title-plain-text">Title:</label><textarea class="block-editor-plain-text" id="title-plain-text" placeholder="(no title)" rows="1" style="overflow: hidden; overflow-wrap: break-word; resize: none; height: 18px;"></textarea></div><div class="components-panel__row"><button type="button" class="components-button is-primary">Reset</button></div></div></div>"`;
|
6
|
-
|
7
|
-
exports[`Using Plugins API Sidebar Should open plugins sidebar using More Menu item and render content 1`] = `"<div class="components-panel__header interface-complementary-area-header__small"><span class="interface-complementary-area-header__small-title">(no title)</span><button type="button" aria-controls="my-sidebar-plugin:title-sidebar" class="components-button has-icon" aria-label="Close plugin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg></button></div><div class="components-panel__header interface-complementary-area-header" tabindex="-1"><strong>Plugin title</strong><button type="button" aria-pressed="true" aria-expanded="true" class="components-button interface-complementary-area__pin-unpin-item is-pressed has-icon" aria-label="Unpin from toolbar"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"></path></svg></button><button type="button" aria-controls="my-sidebar-plugin:title-sidebar" class="components-button has-icon" aria-label="Close plugin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg></button></div><div class="components-panel"><div class="components-panel__body sidebar-title-plugin-panel is-opened"><div class="components-panel__row"><label for="title-plain-text">Title:</label><textarea class="block-editor-plain-text" id="title-plain-text" placeholder="(no title)" rows="1" style="overflow: hidden; overflow-wrap: break-word; resize: none; height: 18px;"></textarea></div><div class="components-panel__row"><button type="button" class="components-button is-primary">Reset</button></div></div></div>"`;
|
@@ -1,234 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
activatePlugin,
|
6
|
-
createNewPost,
|
7
|
-
deactivatePlugin,
|
8
|
-
getAllBlocks,
|
9
|
-
getEditedPostContent,
|
10
|
-
insertBlock,
|
11
|
-
selectBlockByClientId,
|
12
|
-
setPostContent,
|
13
|
-
clickBlockToolbarButton,
|
14
|
-
} from '@wordpress/e2e-test-utils';
|
15
|
-
|
16
|
-
const alignLabels = {
|
17
|
-
none: 'None',
|
18
|
-
left: 'Align left',
|
19
|
-
center: 'Align center',
|
20
|
-
right: 'Align right',
|
21
|
-
wide: 'Wide width',
|
22
|
-
full: 'Full width',
|
23
|
-
};
|
24
|
-
|
25
|
-
/**
|
26
|
-
* Helper function to get the `labels` of align control. It actually evaluates the
|
27
|
-
* basic label of the button without the `info` text node if exists.
|
28
|
-
*
|
29
|
-
* @param {Object} options Options for the util function
|
30
|
-
* @param {boolean} [options.getActiveButtonLabels=false] Flag for returning the active buttons labels only.
|
31
|
-
* @return {string[]} The matched labels.
|
32
|
-
*/
|
33
|
-
const getAlignmentToolbarLabels = async ( {
|
34
|
-
getActiveButtonLabels = false,
|
35
|
-
} = {} ) => {
|
36
|
-
const selector = `.components-dropdown-menu__menu button${
|
37
|
-
getActiveButtonLabels ? '.is-active' : ''
|
38
|
-
} .components-menu-item__item`;
|
39
|
-
return page.evaluate( ( _selector ) => {
|
40
|
-
return (
|
41
|
-
Array.from( document.querySelectorAll( _selector ) )
|
42
|
-
/**
|
43
|
-
* We neede this for now because conditionally there could be two nodes
|
44
|
-
* with the same class(). This should be removed when the following
|
45
|
-
* issue is resolved.
|
46
|
-
*
|
47
|
-
* @see https://github.com/WordPress/gutenberg/issues/34838
|
48
|
-
*/
|
49
|
-
.filter( ( contentNode ) => ! contentNode.childElementCount )
|
50
|
-
.map( ( contentNode ) => {
|
51
|
-
return contentNode.innerText;
|
52
|
-
} )
|
53
|
-
);
|
54
|
-
}, selector );
|
55
|
-
};
|
56
|
-
|
57
|
-
const expectActiveButtonLabelToBe = async ( expected ) => {
|
58
|
-
await clickBlockToolbarButton( 'Align' );
|
59
|
-
const activeButtonLabels = await getAlignmentToolbarLabels( {
|
60
|
-
getActiveButtonLabels: true,
|
61
|
-
} );
|
62
|
-
expect( activeButtonLabels ).toHaveLength( 1 );
|
63
|
-
expect( activeButtonLabels[ 0 ] ).toEqual( expected );
|
64
|
-
};
|
65
|
-
|
66
|
-
const createShowsTheExpectedButtonsTest = ( blockName, buttonLabels ) => {
|
67
|
-
it( 'Shows the expected buttons on the alignment toolbar', async () => {
|
68
|
-
await insertBlock( blockName );
|
69
|
-
await clickBlockToolbarButton( 'Align' );
|
70
|
-
expect( await getAlignmentToolbarLabels() ).toEqual(
|
71
|
-
expect.arrayContaining( buttonLabels )
|
72
|
-
);
|
73
|
-
} );
|
74
|
-
};
|
75
|
-
|
76
|
-
const createAppliesNoneAlignmentByDefaultTest = ( blockName ) => {
|
77
|
-
it( 'applies none alignment by default', async () => {
|
78
|
-
await insertBlock( blockName );
|
79
|
-
await expectActiveButtonLabelToBe( alignLabels.none );
|
80
|
-
} );
|
81
|
-
};
|
82
|
-
|
83
|
-
const verifyMarkupIsValid = async ( htmlMarkup ) => {
|
84
|
-
await setPostContent( htmlMarkup );
|
85
|
-
const blocks = await getAllBlocks();
|
86
|
-
expect( blocks ).toHaveLength( 1 );
|
87
|
-
expect( blocks[ 0 ].isValid ).toBeTruthy();
|
88
|
-
};
|
89
|
-
|
90
|
-
const createCorrectlyAppliesAndRemovesAlignmentTest = (
|
91
|
-
blockName,
|
92
|
-
alignment
|
93
|
-
) => {
|
94
|
-
it( 'Correctly applies the selected alignment and correctly removes the alignment', async () => {
|
95
|
-
const BUTTON_XPATH = `//button[contains(@class,'components-dropdown-menu__menu-item')]//span[contains(text(), '${ alignLabels[ alignment ] }')]`;
|
96
|
-
|
97
|
-
// Set the specified alignment.
|
98
|
-
await insertBlock( blockName );
|
99
|
-
await clickBlockToolbarButton( 'Align' );
|
100
|
-
await ( await page.$x( BUTTON_XPATH ) )[ 0 ].click();
|
101
|
-
|
102
|
-
// Verify the button of the specified alignment is pressed.
|
103
|
-
await expectActiveButtonLabelToBe( alignLabels[ alignment ] );
|
104
|
-
|
105
|
-
let htmlMarkup = await getEditedPostContent();
|
106
|
-
|
107
|
-
// Verify the markup of the selected alignment was generated.
|
108
|
-
expect( htmlMarkup ).toMatchSnapshot();
|
109
|
-
|
110
|
-
// Verify the markup can be correctly parsed.
|
111
|
-
await verifyMarkupIsValid( htmlMarkup );
|
112
|
-
|
113
|
-
await selectBlockByClientId( ( await getAllBlocks() )[ 0 ].clientId );
|
114
|
-
|
115
|
-
// Remove the alignment.
|
116
|
-
await clickBlockToolbarButton( 'Align' );
|
117
|
-
await ( await page.$x( BUTTON_XPATH ) )[ 0 ].click();
|
118
|
-
|
119
|
-
// Verify 'none' alignment button is in pressed state.
|
120
|
-
await expectActiveButtonLabelToBe( alignLabels.none );
|
121
|
-
|
122
|
-
// Verify alignment markup was removed from the block.
|
123
|
-
htmlMarkup = await getEditedPostContent();
|
124
|
-
expect( htmlMarkup ).toMatchSnapshot();
|
125
|
-
|
126
|
-
// verify the markup when no alignment is set is valid
|
127
|
-
await verifyMarkupIsValid( htmlMarkup );
|
128
|
-
|
129
|
-
await selectBlockByClientId( ( await getAllBlocks() )[ 0 ].clientId );
|
130
|
-
|
131
|
-
// Verify alignment `none` button is in pressed state after parsing the block.
|
132
|
-
await expectActiveButtonLabelToBe( alignLabels.none );
|
133
|
-
} );
|
134
|
-
};
|
135
|
-
|
136
|
-
describe( 'Align Hook Works As Expected', () => {
|
137
|
-
beforeAll( async () => {
|
138
|
-
await activatePlugin( 'gutenberg-test-align-hook' );
|
139
|
-
} );
|
140
|
-
|
141
|
-
beforeEach( async () => {
|
142
|
-
await createNewPost();
|
143
|
-
} );
|
144
|
-
|
145
|
-
afterAll( async () => {
|
146
|
-
await deactivatePlugin( 'gutenberg-test-align-hook' );
|
147
|
-
} );
|
148
|
-
|
149
|
-
describe( 'Block with no alignment set', () => {
|
150
|
-
const BLOCK_NAME = 'Test No Alignment Set';
|
151
|
-
it( 'Shows no alignment buttons on the alignment toolbar', async () => {
|
152
|
-
await insertBlock( BLOCK_NAME );
|
153
|
-
const CHANGE_ALIGNMENT_BUTTON_SELECTOR =
|
154
|
-
'.block-editor-block-toolbar .components-dropdown-menu__toggle[aria-label="Align"]';
|
155
|
-
const changeAlignmentButton = await page.$(
|
156
|
-
CHANGE_ALIGNMENT_BUTTON_SELECTOR
|
157
|
-
);
|
158
|
-
expect( changeAlignmentButton ).toBe( null );
|
159
|
-
} );
|
160
|
-
|
161
|
-
it( 'Does not save any alignment related attribute or class', async () => {
|
162
|
-
await insertBlock( BLOCK_NAME );
|
163
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
164
|
-
} );
|
165
|
-
} );
|
166
|
-
|
167
|
-
describe( 'Block with align true', () => {
|
168
|
-
const BLOCK_NAME = 'Test Align True';
|
169
|
-
|
170
|
-
createShowsTheExpectedButtonsTest(
|
171
|
-
BLOCK_NAME,
|
172
|
-
Object.values( alignLabels )
|
173
|
-
);
|
174
|
-
|
175
|
-
createAppliesNoneAlignmentByDefaultTest( BLOCK_NAME );
|
176
|
-
|
177
|
-
createCorrectlyAppliesAndRemovesAlignmentTest( BLOCK_NAME, 'right' );
|
178
|
-
} );
|
179
|
-
|
180
|
-
describe( 'Block with align array', () => {
|
181
|
-
const BLOCK_NAME = 'Test Align Array';
|
182
|
-
|
183
|
-
createShowsTheExpectedButtonsTest( BLOCK_NAME, [
|
184
|
-
alignLabels.none,
|
185
|
-
alignLabels.left,
|
186
|
-
alignLabels.center,
|
187
|
-
] );
|
188
|
-
|
189
|
-
createAppliesNoneAlignmentByDefaultTest( BLOCK_NAME );
|
190
|
-
|
191
|
-
createCorrectlyAppliesAndRemovesAlignmentTest( BLOCK_NAME, 'center' );
|
192
|
-
} );
|
193
|
-
|
194
|
-
describe( 'Block with default align', () => {
|
195
|
-
const BLOCK_NAME = 'Test Default Align';
|
196
|
-
const SELECTED_ALIGNMENT_CONTROL_SELECTOR =
|
197
|
-
'//div[contains(@class, "components-dropdown-menu__menu")]//button[contains(@class, "is-active")]/span[text()="Align right"]';
|
198
|
-
createShowsTheExpectedButtonsTest(
|
199
|
-
BLOCK_NAME,
|
200
|
-
Object.values( alignLabels )
|
201
|
-
);
|
202
|
-
|
203
|
-
it( 'Applies the selected alignment by default', async () => {
|
204
|
-
await insertBlock( BLOCK_NAME );
|
205
|
-
// Verify the correct alignment button is pressed.
|
206
|
-
await clickBlockToolbarButton( 'Align' );
|
207
|
-
const selectedAlignmentControls = await page.$x(
|
208
|
-
SELECTED_ALIGNMENT_CONTROL_SELECTOR
|
209
|
-
);
|
210
|
-
expect( selectedAlignmentControls ).toHaveLength( 1 );
|
211
|
-
} );
|
212
|
-
|
213
|
-
it( 'The default markup does not contain the alignment attribute but contains the alignment class', async () => {
|
214
|
-
await insertBlock( BLOCK_NAME );
|
215
|
-
const markup = await getEditedPostContent();
|
216
|
-
expect( markup ).not.toContain( '"align":"right"' );
|
217
|
-
expect( markup ).toContain( 'alignright' );
|
218
|
-
} );
|
219
|
-
|
220
|
-
it( 'Can remove the default alignment and the align attribute equals none but alignnone class is not applied', async () => {
|
221
|
-
await insertBlock( BLOCK_NAME );
|
222
|
-
// Remove the alignment.
|
223
|
-
await clickBlockToolbarButton( 'Align' );
|
224
|
-
const [ selectedAlignmentControl ] = await page.$x(
|
225
|
-
SELECTED_ALIGNMENT_CONTROL_SELECTOR
|
226
|
-
);
|
227
|
-
await selectedAlignmentControl.click();
|
228
|
-
const markup = await getEditedPostContent();
|
229
|
-
expect( markup ).toContain( '"align":""' );
|
230
|
-
} );
|
231
|
-
|
232
|
-
createCorrectlyAppliesAndRemovesAlignmentTest( BLOCK_NAME, 'center' );
|
233
|
-
} );
|
234
|
-
} );
|