@wordpress/e2e-tests 9.6.0 → 9.6.1-next.v.202603102151.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "9.6.0",
3
+ "version": "9.6.1-next.v.202603102151.0+59e17f9ec",
4
4
  "description": "Test plugins and mu-plugins for E2E tests in WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -24,8 +24,8 @@
24
24
  "npm": ">=8.19.2"
25
25
  },
26
26
  "dependencies": {
27
- "@wordpress/interactivity": "^6.41.0",
28
- "@wordpress/interactivity-router": "^2.41.0"
27
+ "@wordpress/interactivity": "^6.41.2-next.v.202603102151.0+59e17f9ec",
28
+ "@wordpress/interactivity-router": "^2.41.2-next.v.202603102151.0+59e17f9ec"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "jest": ">=29",
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "8bfc179b9aed74c0a6dd6e8edf7a49e40e4f87cc"
39
+ "gitHead": "86db21e727d89e8f0dbba9300d2f97fd22b08693"
40
40
  }
@@ -0,0 +1,66 @@
1
+ <?php
2
+ /**
3
+ * Plugin Name: Gutenberg Test Connectors Capability Restriction
4
+ * Plugin URI: https://github.com/WordPress/gutenberg
5
+ * Author: Gutenberg Team
6
+ *
7
+ * @package gutenberg-test-connectors-capability-restriction
8
+ */
9
+
10
+ add_action(
11
+ 'init',
12
+ static function () {
13
+ register_setting(
14
+ 'general',
15
+ 'gutenberg_test_cap_restriction',
16
+ array(
17
+ 'type' => 'string',
18
+ 'default' => '',
19
+ 'show_in_rest' => true,
20
+ )
21
+ );
22
+ }
23
+ );
24
+
25
+ register_deactivation_hook(
26
+ __FILE__,
27
+ static function () {
28
+ delete_option( 'gutenberg_test_cap_restriction' );
29
+ }
30
+ );
31
+
32
+ add_filter(
33
+ 'map_meta_cap',
34
+ static function ( $caps, $cap ) {
35
+ $restriction = get_option( 'gutenberg_test_cap_restriction', '' );
36
+
37
+ if ( empty( $restriction ) ) {
38
+ return $caps;
39
+ }
40
+
41
+ $blocked_caps = array();
42
+
43
+ switch ( $restriction ) {
44
+ case 'no_install':
45
+ $blocked_caps = array( 'install_plugins', 'upload_plugins' );
46
+ break;
47
+ case 'no_activate':
48
+ $blocked_caps = array( 'activate_plugins' );
49
+ break;
50
+ case 'no_install_activate':
51
+ $blocked_caps = array( 'install_plugins', 'upload_plugins', 'activate_plugins' );
52
+ break;
53
+ case 'disallow_file_mods':
54
+ $blocked_caps = array( 'install_plugins', 'upload_plugins', 'delete_plugins', 'update_plugins' );
55
+ break;
56
+ }
57
+
58
+ if ( in_array( $cap, $blocked_caps, true ) ) {
59
+ return array( 'do_not_allow' );
60
+ }
61
+
62
+ return $caps;
63
+ },
64
+ 10,
65
+ 2
66
+ );
@@ -1,4 +1,4 @@
1
1
  window.addEventListener( 'load', () => {
2
- document.body.dataset.iframedEnqueueBlockAssetsL10n =
2
+ document.documentElement.dataset.iframedEnqueueBlockAssetsL10n =
3
3
  window.iframedEnqueueBlockAssetsL10n.test;
4
4
  } );
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
3
+ "apiVersion": 3,
4
+ "name": "test/router-race-condition",
5
+ "title": "E2E Interactivity tests - router race condition",
6
+ "category": "text",
7
+ "icon": "heart",
8
+ "description": "",
9
+ "supports": {
10
+ "interactivity": true
11
+ },
12
+ "textdomain": "e2e-interactivity",
13
+ "viewScriptModule": "file:./view.js",
14
+ "render": "file:./render.php"
15
+ }
@@ -0,0 +1,26 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the router hydration race condition.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ *
7
+ * @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
8
+ */
9
+ ?>
10
+ <div
11
+ data-wp-interactive="router-race-condition"
12
+ data-wp-router-region="router-race-condition/buttons"
13
+ data-wp-context='{ "counter": 0 }'
14
+ >
15
+ <button
16
+ data-testid="context-counter"
17
+ data-wp-text="context.counter"
18
+ data-wp-on--click="actions.increment"
19
+ >0</button>
20
+
21
+ <button
22
+ data-testid="global-counter"
23
+ data-wp-text="state.counter"
24
+ data-wp-on--click="actions.incrementGlobal"
25
+ >0</button>
26
+ </div>
@@ -0,0 +1,9 @@
1
+ <?php return array(
2
+ 'dependencies' => array(
3
+ '@wordpress/interactivity',
4
+ array(
5
+ 'id' => '@wordpress/interactivity-router',
6
+ 'import' => 'static',
7
+ ),
8
+ ),
9
+ );
@@ -0,0 +1,20 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { store, getContext } from '@wordpress/interactivity';
5
+ import '@wordpress/interactivity-router';
6
+
7
+ const { state } = store( 'router-race-condition', {
8
+ state: {
9
+ counter: 0,
10
+ },
11
+ actions: {
12
+ increment() {
13
+ const context = getContext();
14
+ context.counter += 1;
15
+ },
16
+ incrementGlobal() {
17
+ state.counter += 1;
18
+ },
19
+ },
20
+ } );