@wordpress/e2e-tests 8.5.0 → 8.7.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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 8.7.0 (2024-09-05)
6
+
7
+ ## 8.6.0 (2024-08-21)
8
+
5
9
  ## 8.5.0 (2024-08-07)
6
10
 
7
11
  ## 8.4.0 (2024-07-24)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "8.5.0",
3
+ "version": "8.7.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",
@@ -24,13 +24,13 @@
24
24
  "npm": ">=8.19.2"
25
25
  },
26
26
  "dependencies": {
27
- "@wordpress/e2e-test-utils": "^11.5.0",
28
- "@wordpress/interactivity": "^6.5.0",
29
- "@wordpress/interactivity-router": "^2.5.0",
30
- "@wordpress/jest-console": "^8.5.0",
31
- "@wordpress/jest-puppeteer-axe": "^7.5.0",
32
- "@wordpress/scripts": "^28.5.0",
33
- "@wordpress/url": "^4.5.0",
27
+ "@wordpress/e2e-test-utils": "^11.7.0",
28
+ "@wordpress/interactivity": "^6.7.0",
29
+ "@wordpress/interactivity-router": "^2.7.0",
30
+ "@wordpress/jest-console": "^8.7.0",
31
+ "@wordpress/jest-puppeteer-axe": "^7.7.0",
32
+ "@wordpress/scripts": "^29.0.0",
33
+ "@wordpress/url": "^4.7.0",
34
34
  "chalk": "^4.0.0",
35
35
  "expect-puppeteer": "^4.4.0",
36
36
  "filenamify": "^4.2.0",
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "c3101ab024e2bfc85d525c6d247e0d57cafc9fd9"
50
+ "gitHead": "c90d920de07c53dff82c5914635b56fafa503b7f"
51
51
  }
@@ -0,0 +1,72 @@
1
+ <?php
2
+ /**
3
+ * Plugin Name: Gutenberg Test Block Template Registration
4
+ * Plugin URI: https://github.com/WordPress/gutenberg
5
+ * Author: Gutenberg Team
6
+ *
7
+ * @package gutenberg-test-block-template-registration
8
+ */
9
+
10
+ add_action(
11
+ 'init',
12
+ function () {
13
+ // Custom template used by most tests.
14
+ wp_register_block_template(
15
+ 'gutenberg//plugin-template',
16
+ array(
17
+ 'title' => 'Plugin Template',
18
+ 'description' => 'A template registered by a plugin.',
19
+ 'content' => '<!-- wp:template-part {"slug":"header","tagName":"header"} /--><!-- wp:group {"tagName":"main","layout":{"inherit":true}} --><main class="wp-block-group"><!-- wp:paragraph --><p>This is a plugin-registered template.</p><!-- /wp:paragraph --></main><!-- /wp:group -->',
20
+ 'post_types' => array( 'post' ),
21
+ )
22
+ );
23
+ add_action(
24
+ 'category_template_hierarchy',
25
+ function () {
26
+ return array( 'plugin-template' );
27
+ }
28
+ );
29
+
30
+ // Custom template overridden by the theme.
31
+ wp_register_block_template(
32
+ 'gutenberg//custom-template',
33
+ array(
34
+ 'title' => 'Custom Template (overridden by the theme)',
35
+ 'description' => 'A custom template registered by a plugin and overridden by a theme.',
36
+ 'content' => '<!-- wp:template-part {"slug":"header","tagName":"header"} /--><!-- wp:group {"tagName":"main","layout":{"inherit":true}} --><main class="wp-block-group"><!-- wp:paragraph --><p>This is a plugin-registered template and overridden by a theme.</p><!-- /wp:paragraph --></main><!-- /wp:group -->',
37
+ 'post_types' => array( 'post' ),
38
+ )
39
+ );
40
+
41
+ // Custom template used to test unregistration.
42
+ wp_register_block_template(
43
+ 'gutenberg//plugin-unregistered-template',
44
+ array(
45
+ 'title' => 'Plugin Unregistered Template',
46
+ 'description' => 'A plugin-registered template that is unregistered.',
47
+ 'content' => '<!-- wp:template-part {"slug":"header","tagName":"header"} /--><!-- wp:group {"tagName":"main","layout":{"inherit":true}} --><main class="wp-block-group"><!-- wp:paragraph --><p>This is a plugin-registered template that is also unregistered.</p><!-- /wp:paragraph --></main><!-- /wp:group -->',
48
+ )
49
+ );
50
+ wp_unregister_block_template( 'gutenberg//plugin-unregistered-template' );
51
+
52
+ // Custom template used to test overriding default WP templates.
53
+ wp_register_block_template(
54
+ 'gutenberg//page',
55
+ array(
56
+ 'title' => 'Plugin Page Template',
57
+ 'description' => 'A plugin-registered page template.',
58
+ 'content' => '<!-- wp:template-part {"slug":"header","tagName":"header"} /--><!-- wp:group {"tagName":"main","layout":{"inherit":true}} --><main class="wp-block-group"><!-- wp:paragraph --><p>This is a plugin-registered page template.</p><!-- /wp:paragraph --></main><!-- /wp:group -->',
59
+ )
60
+ );
61
+
62
+ // Custom template used to test overriding default WP templates which can be created by the user.
63
+ wp_register_block_template(
64
+ 'gutenberg//author-admin',
65
+ array(
66
+ 'title' => 'Plugin Author Template',
67
+ 'description' => 'A plugin-registered author template.',
68
+ 'content' => '<!-- wp:template-part {"slug":"header","tagName":"header"} /--><!-- wp:group {"tagName":"main","layout":{"inherit":true}} --><main class="wp-block-group"><!-- wp:paragraph --><p>This is a plugin-registered author template.</p><!-- /wp:paragraph --></main><!-- /wp:group -->',
69
+ )
70
+ );
71
+ }
72
+ );
@@ -212,3 +212,24 @@
212
212
  ></span>
213
213
  </div>
214
214
  </div>
215
+
216
+
217
+ <div
218
+ data-testid="inheritance from other namespaces"
219
+ data-wp-interactive="directive-context/parent"
220
+ data-wp-context='{ "prop": "fromParentNs" }'
221
+ >
222
+ <div
223
+ data-wp-interactive="directive-context/child"
224
+ data-wp-context='{ "prop": "fromChildNs" }'
225
+ >
226
+ <span
227
+ data-testid="parent"
228
+ data-wp-text="directive-context/parent::context.prop"
229
+ ></span>
230
+ <span
231
+ data-testid="child"
232
+ data-wp-text="directive-context/child::context.prop"
233
+ ></span>
234
+ </div>
235
+ </div>
@@ -0,0 +1,14 @@
1
+ ( function () {
2
+ const { __ } = wp.i18n;
3
+ const { registerPlugin } = wp.plugins;
4
+ const PluginPreviewMenuItem = wp.editor.PluginPreviewMenuItem;
5
+ const el = wp.element.createElement;
6
+
7
+ function CustomPreviewMenuItem() {
8
+ return el( PluginPreviewMenuItem, {}, __( 'Custom Preview' ) );
9
+ }
10
+
11
+ registerPlugin( 'custom-preview-menu-item', {
12
+ render: CustomPreviewMenuItem,
13
+ } );
14
+ } )();
@@ -86,6 +86,19 @@ function enqueue_plugins_api_plugin_scripts() {
86
86
  filemtime( plugin_dir_path( __FILE__ ) . 'plugins-api/document-setting.js' ),
87
87
  true
88
88
  );
89
+
90
+ wp_enqueue_script(
91
+ 'gutenberg-test-plugins-api-preview-menu',
92
+ plugins_url( 'plugins-api/preview-menu.js', __FILE__ ),
93
+ array(
94
+ 'wp-editor',
95
+ 'wp-element',
96
+ 'wp-i18n',
97
+ 'wp-plugins',
98
+ ),
99
+ filemtime( plugin_dir_path( __FILE__ ) . 'plugins-api/preview-menu.js' ),
100
+ true
101
+ );
89
102
  }
90
103
 
91
104
  add_action( 'init', 'enqueue_plugins_api_plugin_scripts' );