@wordpress/e2e-tests 7.7.0 → 7.8.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/package.json +7 -7
  3. package/plugins/block-api/index.js +5 -2
  4. package/plugins/block-api.php +2 -0
  5. package/plugins/deprecated-node-matcher/index.js +12 -16
  6. package/plugins/deprecated-node-matcher.php +0 -1
  7. package/plugins/inner-blocks-allowed-blocks/index.js +1 -0
  8. package/plugins/inner-blocks-templates/index.js +33 -30
  9. package/plugins/interactive-blocks/directive-bind/block.json +14 -0
  10. package/plugins/interactive-blocks/directive-bind/render.php +59 -0
  11. package/plugins/interactive-blocks/directive-bind/view.js +23 -0
  12. package/plugins/interactive-blocks/directive-class/block.json +14 -0
  13. package/plugins/interactive-blocks/directive-class/render.php +75 -0
  14. package/plugins/interactive-blocks/directive-class/view.js +21 -0
  15. package/plugins/interactive-blocks/directive-context/block.json +14 -0
  16. package/plugins/interactive-blocks/directive-context/render.php +121 -0
  17. package/plugins/interactive-blocks/directive-context/view.js +22 -0
  18. package/plugins/interactive-blocks/directive-effect/block.json +14 -0
  19. package/plugins/interactive-blocks/directive-effect/render.php +27 -0
  20. package/plugins/interactive-blocks/directive-effect/view.js +61 -0
  21. package/plugins/interactive-blocks/directive-priorities/block.json +14 -0
  22. package/plugins/interactive-blocks/directive-priorities/render.php +20 -0
  23. package/plugins/interactive-blocks/directive-priorities/view.js +121 -0
  24. package/plugins/interactive-blocks/directive-show/block.json +14 -0
  25. package/plugins/interactive-blocks/directive-show/render.php +53 -0
  26. package/plugins/interactive-blocks/directive-show/view.js +24 -0
  27. package/plugins/interactive-blocks/directive-text/block.json +14 -0
  28. package/plugins/interactive-blocks/directive-text/render.php +35 -0
  29. package/plugins/interactive-blocks/directive-text/view.js +17 -0
  30. package/plugins/interactive-blocks/negation-operator/block.json +14 -0
  31. package/plugins/interactive-blocks/negation-operator/render.php +26 -0
  32. package/plugins/interactive-blocks/negation-operator/view.js +22 -0
  33. package/plugins/interactive-blocks/store-tag/block.json +14 -0
  34. package/plugins/interactive-blocks/store-tag/render.php +64 -0
  35. package/plugins/interactive-blocks/store-tag/view.js +24 -0
  36. package/plugins/interactive-blocks/tovdom/block.json +14 -0
  37. package/plugins/interactive-blocks/tovdom/cdata.js +15 -0
  38. package/plugins/interactive-blocks/tovdom/processing-instructions.js +16 -0
  39. package/plugins/interactive-blocks/tovdom/render.php +33 -0
  40. package/plugins/interactive-blocks/tovdom/view.js +5 -0
  41. package/plugins/interactive-blocks/tovdom-islands/block.json +14 -0
  42. package/plugins/interactive-blocks/tovdom-islands/render.php +66 -0
  43. package/plugins/interactive-blocks/tovdom-islands/view.js +9 -0
  44. package/plugins/interactive-blocks.php +48 -0
  45. package/specs/editor/plugins/container-blocks.test.js +2 -1
  46. package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +1 -1
  47. package/specs/editor/various/links.test.js +18 -11
  48. package/specs/editor/various/reusable-blocks.test.js +5 -5
  49. package/specs/experiments/blocks/post-comments-form.test.js +1 -1
  50. package/specs/site-editor/settings-sidebar.test.js +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 7.8.0 (2023-07-05)
6
+
5
7
  ## 7.7.0 (2023-06-23)
6
8
 
7
9
  ## 7.6.0 (2023-06-07)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "7.7.0",
3
+ "version": "7.8.0",
4
4
  "description": "End-To-End (E2E) tests for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -23,11 +23,11 @@
23
23
  "node": ">=14"
24
24
  },
25
25
  "dependencies": {
26
- "@wordpress/e2e-test-utils": "^10.7.0",
27
- "@wordpress/jest-console": "^7.7.0",
28
- "@wordpress/jest-puppeteer-axe": "^6.7.0",
29
- "@wordpress/scripts": "^26.7.0",
30
- "@wordpress/url": "^3.37.0",
26
+ "@wordpress/e2e-test-utils": "^10.8.0",
27
+ "@wordpress/jest-console": "^7.8.0",
28
+ "@wordpress/jest-puppeteer-axe": "^6.8.0",
29
+ "@wordpress/scripts": "^26.8.0",
30
+ "@wordpress/url": "^3.38.0",
31
31
  "chalk": "^4.0.0",
32
32
  "expect-puppeteer": "^4.4.0",
33
33
  "filenamify": "^4.2.0",
@@ -45,5 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "d47d8069e1aae05d4a16dc287902eb90edcbff50"
48
+ "gitHead": "bcd13d59b22553b3c9dc5869077bff1e864cf9f5"
49
49
  }
@@ -1,13 +1,16 @@
1
1
  ( function () {
2
2
  const { registerBlockType } = wp.blocks;
3
+ const { useBlockProps } = wp.blockEditor;
4
+ const { createElement: el } = wp.element;
3
5
  const { addFilter } = wp.hooks;
4
6
 
5
7
  registerBlockType( 'e2e-tests/hello-world', {
8
+ apiVersion: 3,
6
9
  title: 'Hello World',
7
10
  description: 'Hello World test block.',
8
11
  category: 'widgets',
9
- edit() {
10
- return 'Hello Editor!';
12
+ edit: function Edit() {
13
+ return el( 'p', useBlockProps(), 'Hello Editor!' );
11
14
  },
12
15
  save() {
13
16
  return 'Hello Frontend!';
@@ -16,6 +16,8 @@ function enqueue_block_api_plugin_script() {
16
16
  plugins_url( 'block-api/index.js', __FILE__ ),
17
17
  array(
18
18
  'wp-blocks',
19
+ 'wp-block-editor',
20
+ 'wp-element',
19
21
  'wp-hooks',
20
22
  ),
21
23
  filemtime( plugin_dir_path( __FILE__ ) . 'block-api/index.js' ),
@@ -1,9 +1,10 @@
1
1
  ( function () {
2
2
  const registerBlockType = wp.blocks.registerBlockType;
3
- const RichText = wp.blockEditor.RichText;
3
+ const { useBlockProps, RichText } = wp.blockEditor;
4
4
  const el = wp.element.createElement;
5
5
 
6
6
  registerBlockType( 'core/deprecated-children-matcher', {
7
+ apiVersion: 3,
7
8
  title: 'Deprecated Children Matcher',
8
9
  attributes: {
9
10
  value: {
@@ -13,40 +14,35 @@
13
14
  },
14
15
  },
15
16
  category: 'text',
16
- edit( { attributes, setAttributes } ) {
17
+ edit: function EditChildrenMatcher( { attributes, setAttributes } ) {
17
18
  return el( RichText, {
18
19
  tagName: 'p',
19
20
  value: attributes.value,
20
21
  onChange( nextValue ) {
21
22
  setAttributes( { value: nextValue } );
22
23
  },
24
+ ...useBlockProps(),
23
25
  } );
24
26
  },
25
27
  save( { attributes } ) {
26
28
  return el( RichText.Content, {
27
29
  tagName: 'p',
28
30
  value: attributes.value,
31
+ ...useBlockProps.save(),
29
32
  } );
30
33
  },
31
34
  } );
32
35
 
33
36
  function toRichTextValue( value ) {
34
- // eslint-disable-next-line no-undef
35
- return _.map( value, function ( subValue ) {
36
- return subValue.children;
37
- } );
37
+ return value?.map( ( { children } ) => children ) ?? [];
38
38
  }
39
39
 
40
40
  function fromRichTextValue( value ) {
41
- // eslint-disable-next-line no-undef
42
- return _.map( value, function ( subValue ) {
43
- return {
44
- children: subValue,
45
- };
46
- } );
41
+ return value.map( ( subValue ) => ( { children: subValue } ) );
47
42
  }
48
43
 
49
44
  registerBlockType( 'core/deprecated-node-matcher', {
45
+ apiVersion: 3,
50
46
  title: 'Deprecated Node Matcher',
51
47
  attributes: {
52
48
  value: {
@@ -61,10 +57,10 @@
61
57
  },
62
58
  },
63
59
  category: 'text',
64
- edit( { attributes, setAttributes } ) {
60
+ edit: function EditNodeMatcher( { attributes, setAttributes } ) {
65
61
  return el(
66
62
  'blockquote',
67
- {},
63
+ useBlockProps(),
68
64
  el( RichText, {
69
65
  multiline: 'p',
70
66
  value: toRichTextValue( attributes.value ),
@@ -74,12 +70,12 @@
74
70
  } );
75
71
  },
76
72
  } )
77
- );
73
+ )
78
74
  },
79
75
  save( { attributes } ) {
80
76
  return el(
81
77
  'blockquote',
82
- {},
78
+ useBlockProps.save(),
83
79
  el( RichText.Content, {
84
80
  value: toRichTextValue( attributes.value ),
85
81
  } )
@@ -15,7 +15,6 @@ function enqueue_deprecated_node_matcher_plugin_script() {
15
15
  'gutenberg-test-deprecated-node-matcher',
16
16
  plugins_url( 'deprecated-node-matcher/index.js', __FILE__ ),
17
17
  array(
18
- 'lodash',
19
18
  'wp-blocks',
20
19
  'wp-element',
21
20
  'wp-block-editor',
@@ -12,6 +12,7 @@
12
12
  const allowedBlocksWhenMultipleChildren = [ 'core/gallery', 'core/video' ];
13
13
 
14
14
  registerBlockType( 'test/allowed-blocks-dynamic', {
15
+ apiVersion: 3,
15
16
  title: 'Allowed Blocks Dynamic',
16
17
  icon: 'carrot',
17
18
  category: 'text',
@@ -2,7 +2,7 @@
2
2
  const registerBlockType = wp.blocks.registerBlockType;
3
3
  const createBlock = wp.blocks.createBlock;
4
4
  const el = wp.element.createElement;
5
- const InnerBlocks = wp.blockEditor.InnerBlocks;
5
+ const { InnerBlocks, useBlockProps } = wp.blockEditor;
6
6
  const useState = window.wp.element.useState;
7
7
 
8
8
  const TEMPLATE = [
@@ -47,35 +47,38 @@
47
47
  };
48
48
 
49
49
  registerBlockType( 'test/test-inner-blocks-no-locking', {
50
+ apiVersion: 3,
50
51
  title: 'Test Inner Blocks no locking',
51
52
  icon: 'cart',
52
53
  category: 'text',
53
54
 
54
- edit() {
55
- return el( InnerBlocks, {
55
+ edit: function InnerBlocksNoLockingEdit() {
56
+ return el( 'div', useBlockProps(), el( InnerBlocks, {
56
57
  template: TEMPLATE,
57
- } );
58
+ } ) );
58
59
  },
59
60
 
60
61
  save,
61
62
  } );
62
63
 
63
64
  registerBlockType( 'test/test-inner-blocks-locking-all', {
65
+ apiVersion: 3,
64
66
  title: 'Test InnerBlocks locking all',
65
67
  icon: 'cart',
66
68
  category: 'text',
67
69
 
68
- edit() {
69
- return el( InnerBlocks, {
70
+ edit: function InnerBlocksBlocksLockingAllEdit() {
71
+ return el( 'div', useBlockProps(), el( InnerBlocks, {
70
72
  template: TEMPLATE,
71
73
  templateLock: 'all',
72
- } );
74
+ } ) );
73
75
  },
74
76
 
75
77
  save,
76
78
  } );
77
79
 
78
80
  registerBlockType( 'test/test-inner-blocks-update-locked-template', {
81
+ apiVersion: 3,
79
82
  title: 'Test Inner Blocks update locked template',
80
83
  icon: 'cart',
81
84
  category: 'text',
@@ -87,7 +90,7 @@
87
90
  },
88
91
  },
89
92
 
90
- edit( props ) {
93
+ edit: function InnerBlocksUpdateLockedTemplateEdit( props ) {
91
94
  const hasUpdatedTemplated = props.attributes.hasUpdatedTemplate;
92
95
  return el( 'div', null, [
93
96
  el(
@@ -99,12 +102,12 @@
99
102
  },
100
103
  'Update template'
101
104
  ),
102
- el( InnerBlocks, {
105
+ el( 'div', useBlockProps(), el( InnerBlocks, {
103
106
  template: hasUpdatedTemplated
104
107
  ? TEMPLATE_TWO_PARAGRAPHS
105
108
  : TEMPLATE,
106
109
  templateLock: 'all',
107
- } ),
110
+ } ) ),
108
111
  ] );
109
112
  },
110
113
 
@@ -112,21 +115,23 @@
112
115
  } );
113
116
 
114
117
  registerBlockType( 'test/test-inner-blocks-paragraph-placeholder', {
118
+ apiVersion: 3,
115
119
  title: 'Test Inner Blocks Paragraph Placeholder',
116
120
  icon: 'cart',
117
121
  category: 'text',
118
122
 
119
- edit() {
120
- return el( InnerBlocks, {
123
+ edit: function InnerBlocksParagraphPlaceholderEdit() {
124
+ return el( 'div', useBlockProps(), el( InnerBlocks, {
121
125
  template: TEMPLATE_PARAGRAPH_PLACEHOLDER,
122
126
  templateInsertUpdatesSelection: true,
123
- } );
127
+ } ) );
124
128
  },
125
129
 
126
130
  save,
127
131
  } );
128
132
 
129
133
  registerBlockType( 'test/test-inner-blocks-transformer-target', {
134
+ apiVersion: 3,
130
135
  title: 'Test Inner Blocks transformer target',
131
136
  icon: 'cart',
132
137
  category: 'text',
@@ -165,36 +170,34 @@
165
170
  ],
166
171
  },
167
172
 
168
- edit() {
169
- return el( InnerBlocks, {
173
+ edit: function InnerBlocksTransformerTargetEdit() {
174
+ return el( 'div', useBlockProps(), el( InnerBlocks, {
170
175
  template: TEMPLATE,
171
- } );
176
+ } ) );
172
177
  },
173
178
 
174
179
  save,
175
180
  } );
176
181
 
177
-
178
- function InnerBlocksAsyncTemplateEdit() {
179
- const [ template, setTemplate ] = useState( [] );
180
-
181
- setInterval( () => {
182
- setTemplate( TEMPLATE_TWO_PARAGRAPHS );
183
- }, 1000 );
184
-
185
- return el( InnerBlocks, {
186
- template,
187
- } );
188
- }
189
-
190
182
  registerBlockType(
191
183
  'test/test-inner-blocks-async-template',
192
184
  {
185
+ apiVersion: 3,
193
186
  title: 'Test Inner Blocks Async Template',
194
187
  icon: 'cart',
195
188
  category: 'text',
196
189
 
197
- edit: InnerBlocksAsyncTemplateEdit,
190
+ edit: function InnerBlocksAsyncTemplateEdit() {
191
+ const [ template, setTemplate ] = useState( [] );
192
+
193
+ setInterval( () => {
194
+ setTemplate( TEMPLATE_TWO_PARAGRAPHS );
195
+ }, 1000 );
196
+
197
+ return el('div', useBlockProps(), el( InnerBlocks, {
198
+ template,
199
+ } ) );
200
+ },
198
201
 
199
202
  // Purposely do not save inner blocks so that it's possible to test template resolution.
200
203
  save() {},
@@ -0,0 +1,14 @@
1
+ {
2
+ "apiVersion": 2,
3
+ "name": "test/directive-bind",
4
+ "title": "E2E Interactivity tests - directive bind",
5
+ "category": "text",
6
+ "icon": "heart",
7
+ "description": "",
8
+ "supports": {
9
+ "interactivity": true
10
+ },
11
+ "textdomain": "e2e-interactivity",
12
+ "viewScript": "directive-bind-view",
13
+ "render": "file:./render.php"
14
+ }
@@ -0,0 +1,59 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the directive `data-wp-bind`.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ */
7
+
8
+ ?>
9
+ <div data-wp-interactive>
10
+ <a
11
+ data-wp-bind--href="state.url"
12
+ data-testid="add missing href at hydration"
13
+ ></a>
14
+
15
+ <a
16
+ href="/other-url"
17
+ data-wp-bind--href="state.url"
18
+ data-testid="change href at hydration"
19
+ ></a>
20
+
21
+ <input
22
+ type="checkbox"
23
+ data-wp-bind--checked="state.checked"
24
+ data-testid="add missing checked at hydration"
25
+ />
26
+
27
+ <input
28
+ type="checkbox"
29
+ checked
30
+ data-wp-bind--checked="!state.checked"
31
+ data-testid="remove existing checked at hydration"
32
+ />
33
+
34
+ <a
35
+ href="/other-url"
36
+ data-wp-bind--href="state.url"
37
+ data-testid="nested binds - 1"
38
+ >
39
+ <img
40
+ width="1"
41
+ data-wp-bind--width="state.width"
42
+ data-testid="nested binds - 2"
43
+ />
44
+ </a>
45
+
46
+ <button data-testid="toggle" data-wp-on--click="actions.toggle">
47
+ Update
48
+ </button>
49
+
50
+ <p
51
+ data-wp-bind--hidden="!state.show"
52
+ data-wp-bind--aria-hidden="!state.show"
53
+ data-wp-bind--aria-expanded="state.show"
54
+ data-wp-bind--data-some-value="state.show"
55
+ data-testid="check enumerated attributes with true/false exist and have a string value"
56
+ >
57
+ Some Text
58
+ </p>
59
+ </div>
@@ -0,0 +1,23 @@
1
+ ( ( { wp } ) => {
2
+ const { store } = wp.interactivity;
3
+
4
+ store( {
5
+ state: {
6
+ url: '/some-url',
7
+ checked: true,
8
+ show: false,
9
+ width: 1,
10
+ },
11
+ foo: {
12
+ bar: 1,
13
+ },
14
+ actions: {
15
+ toggle: ( { state, foo } ) => {
16
+ state.url = '/some-other-url';
17
+ state.checked = ! state.checked;
18
+ state.show = ! state.show;
19
+ state.width += foo.bar;
20
+ },
21
+ },
22
+ } );
23
+ } )( window );
@@ -0,0 +1,14 @@
1
+ {
2
+ "apiVersion": 2,
3
+ "name": "test/directive-class",
4
+ "title": "E2E Interactivity tests - directive class",
5
+ "category": "text",
6
+ "icon": "heart",
7
+ "description": "",
8
+ "supports": {
9
+ "interactivity": true
10
+ },
11
+ "textdomain": "e2e-interactivity",
12
+ "viewScript": "directive-class-view",
13
+ "render": "file:./render.php"
14
+ }
@@ -0,0 +1,75 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the directive `data-wp-class`.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ */
7
+
8
+ ?>
9
+ <div data-wp-interactive>
10
+ <button
11
+ data-wp-on--click="actions.toggleTrueValue"
12
+ data-testid="toggle trueValue"
13
+ >
14
+ Toggle trueValue
15
+ </button>
16
+
17
+ <button
18
+ data-wp-on--click="actions.toggleFalseValue"
19
+ data-testid="toggle falseValue"
20
+ >
21
+ Toggle falseValue
22
+ </button>
23
+
24
+ <div
25
+ class="foo bar"
26
+ data-wp-class--foo="state.falseValue"
27
+ data-testid="remove class if callback returns falsy value"
28
+ ></div>
29
+
30
+ <div
31
+ class="foo"
32
+ data-wp-class--bar="state.trueValue"
33
+ data-testid="add class if callback returns truthy value"
34
+ ></div>
35
+
36
+ <div
37
+ class="foo bar"
38
+ data-wp-class--foo="state.falseValue"
39
+ data-wp-class--bar="state.trueValue"
40
+ data-wp-class--baz="state.trueValue"
41
+ data-testid="handles multiple classes and callbacks"
42
+ ></div>
43
+
44
+ <div
45
+ class="foo foo-bar"
46
+ data-wp-class--foo="state.falseValue"
47
+ data-wp-class--foo-bar="state.trueValue"
48
+ data-testid="handles class names that are contained inside other class names"
49
+ ></div>
50
+
51
+ <div
52
+ class="foo bar baz"
53
+ data-wp-class--bar="state.trueValue"
54
+ data-testid="can toggle class in the middle"
55
+ ></div>
56
+
57
+ <div
58
+ data-wp-class--foo="state.falseValue"
59
+ data-testid="can toggle class when class attribute is missing"
60
+ ></div>
61
+
62
+ <div data-wp-context='{ "falseValue": false }'>
63
+ <div
64
+ class="foo"
65
+ data-wp-class--foo="context.falseValue"
66
+ data-testid="can use context values"
67
+ ></div>
68
+ <button
69
+ data-wp-on--click="actions.toggleContextFalseValue"
70
+ data-testid="toggle context false value"
71
+ >
72
+ Toggle context falseValue
73
+ </button>
74
+ </div>
75
+ </div>
@@ -0,0 +1,21 @@
1
+ ( ( { wp } ) => {
2
+ const { store } = wp.interactivity;
3
+
4
+ store( {
5
+ state: {
6
+ trueValue: true,
7
+ falseValue: false,
8
+ },
9
+ actions: {
10
+ toggleTrueValue: ( { state } ) => {
11
+ state.trueValue = ! state.trueValue;
12
+ },
13
+ toggleFalseValue: ( { state } ) => {
14
+ state.falseValue = ! state.falseValue;
15
+ },
16
+ toggleContextFalseValue: ( { context } ) => {
17
+ context.falseValue = ! context.falseValue;
18
+ },
19
+ },
20
+ } );
21
+ } )( window );
@@ -0,0 +1,14 @@
1
+ {
2
+ "apiVersion": 2,
3
+ "name": "test/directive-context",
4
+ "title": "E2E Interactivity tests - directive context",
5
+ "category": "text",
6
+ "icon": "heart",
7
+ "description": "",
8
+ "supports": {
9
+ "interactivity": true
10
+ },
11
+ "textdomain": "e2e-interactivity",
12
+ "viewScript": "directive-context-view",
13
+ "render": "file:./render.php"
14
+ }
@@ -0,0 +1,121 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the directive `data-wp-context`.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ */
7
+
8
+ ?>
9
+ <div data-wp-interactive>
10
+ <div
11
+ data-wp-context='{ "prop1":"parent","prop2":"parent","obj":{"prop4":"parent","prop5":"parent"},"array":[1,2,3] }'
12
+ >
13
+ <pre
14
+ data-testid="parent context"
15
+ data-wp-bind--children="derived.renderContext"
16
+ >
17
+ <!-- rendered during hydration -->
18
+ </pre>
19
+ <button
20
+ data-testid="parent prop1"
21
+ name="prop1"
22
+ value="modifiedFromParent"
23
+ data-wp-on--click="actions.updateContext"
24
+ >
25
+ prop1
26
+ </button>
27
+ <button
28
+ data-testid="parent prop2"
29
+ name="prop2"
30
+ value="modifiedFromParent"
31
+ data-wp-on--click="actions.updateContext"
32
+ >
33
+ prop2
34
+ </button>
35
+ <button
36
+ data-testid="parent obj.prop4"
37
+ name="obj.prop4"
38
+ value="modifiedFromParent"
39
+ data-wp-on--click="actions.updateContext"
40
+ >
41
+ obj.prop4
42
+ </button>
43
+ <button
44
+ data-testid="parent obj.prop5"
45
+ name="obj.prop5"
46
+ value="modifiedFromParent"
47
+ data-wp-on--click="actions.updateContext"
48
+ >
49
+ obj.prop5
50
+ </button>
51
+ <div
52
+ data-wp-context='{ "prop2":"child","prop3":"child","obj":{"prop5":"child","prop6":"child"},"array":[4,5,6] }'
53
+ >
54
+ <pre
55
+ data-testid="child context"
56
+ data-wp-bind--children="derived.renderContext"
57
+ >
58
+ <!-- rendered during hydration -->
59
+ </pre>
60
+ <button
61
+ data-testid="child prop1"
62
+ name="prop1"
63
+ value="modifiedFromChild"
64
+ data-wp-on--click="actions.updateContext"
65
+ >
66
+ prop1
67
+ </button>
68
+ <button
69
+ data-testid="child prop2"
70
+ name="prop2"
71
+ value="modifiedFromChild"
72
+ data-wp-on--click="actions.updateContext"
73
+ >
74
+ prop2
75
+ </button>
76
+ <button
77
+ data-testid="child prop3"
78
+ name="prop3"
79
+ value="modifiedFromChild"
80
+ data-wp-on--click="actions.updateContext"
81
+ >
82
+ prop3
83
+ </button>
84
+ <button
85
+ data-testid="child obj.prop4"
86
+ name="obj.prop4"
87
+ value="modifiedFromChild"
88
+ data-wp-on--click="actions.updateContext"
89
+ >
90
+ obj.prop4
91
+ </button>
92
+ <button
93
+ data-testid="child obj.prop5"
94
+ name="obj.prop5"
95
+ value="modifiedFromChild"
96
+ data-wp-on--click="actions.updateContext"
97
+ >
98
+ obj.prop5
99
+ </button>
100
+ <button
101
+ data-testid="child obj.prop6"
102
+ name="obj.prop6"
103
+ value="modifiedFromChild"
104
+ data-wp-on--click="actions.updateContext"
105
+ >
106
+ obj.prop6
107
+ </button>
108
+ </div>
109
+ <br />
110
+
111
+ <button
112
+ data-testid="context & other directives"
113
+ data-wp-context='{ "text": "Text 1" }'
114
+ data-wp-text="context.text"
115
+ data-wp-on--click="actions.toggleContextText"
116
+ data-wp-bind--value="context.text"
117
+ >
118
+ Toggle Context Text
119
+ </button>
120
+ </div>
121
+ </div>