@wordpress/e2e-tests 9.8.0 → 9.8.1-next.v.202604091042.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.8.0",
3
+ "version": "9.8.1-next.v.202604091042.0+668146787",
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.43.0",
28
- "@wordpress/interactivity-router": "^2.43.0"
27
+ "@wordpress/interactivity": "^6.43.1-next.v.202604091042.0+668146787",
28
+ "@wordpress/interactivity-router": "^2.43.1-next.v.202604091042.0+668146787"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "jest": ">=29",
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "2cea90674d11aa521ec3f71652fb3a6a4c383969"
39
+ "gitHead": "73606df74f1c38a084bfa5db97205259ef817593"
40
40
  }
@@ -23,7 +23,7 @@ const { callbacks } = store( 'test/generator-scope', {
23
23
  let value = yield Promise.resolve( 1 );
24
24
  try {
25
25
  value = yield Promise.reject( 2 );
26
- } catch ( e ) {
26
+ } catch {
27
27
  value = yield Promise.resolve( 3 );
28
28
  }
29
29
  getContext().result = value;
@@ -34,7 +34,7 @@ const { state } = store( 'router', {
34
34
 
35
35
  try {
36
36
  yield actions.navigate( e.target.href, { force, timeout } );
37
- } catch ( error ) {
37
+ } catch {
38
38
  state.status = 'fail';
39
39
  }
40
40
 
@@ -0,0 +1,77 @@
1
+ ( function () {
2
+ const { createElement: el } = wp.element;
3
+ const { useSelect } = wp.data;
4
+ const {
5
+ Modal,
6
+ Button,
7
+ __experimentalVStack: VStack,
8
+ __experimentalHStack: HStack,
9
+ } = wp.components;
10
+ const { __ } = wp.i18n;
11
+ const { registerPlugin } = wp.plugins;
12
+
13
+ function CustomConnectionLimitModal() {
14
+ const connectionStatus = useSelect( function ( select ) {
15
+ return select( 'core' ).getSyncConnectionStatus() || null;
16
+ }, [] );
17
+
18
+ const error =
19
+ connectionStatus &&
20
+ connectionStatus.status === 'disconnected' &&
21
+ connectionStatus.error
22
+ ? connectionStatus.error
23
+ : null;
24
+
25
+ if ( ! error || error.code !== 'connection-limit-exceeded' ) {
26
+ return null;
27
+ }
28
+
29
+ return el(
30
+ Modal,
31
+ {
32
+ title: __( 'Collaboration limit reached' ),
33
+ isDismissible: false,
34
+ onRequestClose() {},
35
+ shouldCloseOnClickOutside: false,
36
+ shouldCloseOnEsc: false,
37
+ size: 'medium',
38
+ },
39
+ el(
40
+ VStack,
41
+ { spacing: 6 },
42
+ el(
43
+ 'p',
44
+ null,
45
+ 'Consider upgrading your hosting plan to increase the collaboration limits.'
46
+ ),
47
+ el(
48
+ HStack,
49
+ { justify: 'right' },
50
+ el(
51
+ Button,
52
+ {
53
+ variant: 'tertiary',
54
+ isDestructive: true,
55
+ href: 'edit.php',
56
+ __next40pxDefaultSize: true,
57
+ },
58
+ __( 'Back to Posts' )
59
+ ),
60
+ el(
61
+ Button,
62
+ {
63
+ variant: 'primary',
64
+ href: 'https://example.com/upgrade',
65
+ __next40pxDefaultSize: true,
66
+ },
67
+ __( 'Upgrade Plan' )
68
+ )
69
+ )
70
+ )
71
+ );
72
+ }
73
+
74
+ registerPlugin( 'custom-sync-connection-error', {
75
+ render: CustomConnectionLimitModal,
76
+ } );
77
+ } )();
@@ -0,0 +1,47 @@
1
+ <?php
2
+ /**
3
+ * Plugin Name: Gutenberg Test Plugin, Sync Connection Error Filter
4
+ * Plugin URI: https://github.com/WordPress/gutenberg
5
+ * Author: Gutenberg Team
6
+ *
7
+ * @package gutenberg-test-sync-connection-error-filter
8
+ */
9
+
10
+ /**
11
+ * Registers the editor.isSyncConnectionErrorHandled filter and custom modal.
12
+ */
13
+ function enqueue_sync_connection_error_filter_scripts() {
14
+ // Register the filter early on wp-hooks so it's available before the
15
+ // editor modal renders. Plugins return true for error codes they handle.
16
+ wp_add_inline_script(
17
+ 'wp-hooks',
18
+ "wp.hooks.addFilter(
19
+ 'editor.isSyncConnectionErrorHandled',
20
+ 'gutenberg-test/custom-sync-error',
21
+ function( isHandled, errorCode ) {
22
+ if ( errorCode === 'connection-limit-exceeded' ) {
23
+ return true;
24
+ }
25
+ return isHandled;
26
+ }
27
+ );"
28
+ );
29
+
30
+ // Enqueue the custom modal component that replaces the default UI
31
+ // for connection-limit-exceeded errors.
32
+ wp_enqueue_script(
33
+ 'gutenberg-test-sync-connection-error-filter',
34
+ plugins_url( 'sync-connection-error-filter/index.js', __FILE__ ),
35
+ array(
36
+ 'wp-components',
37
+ 'wp-data',
38
+ 'wp-element',
39
+ 'wp-i18n',
40
+ 'wp-plugins',
41
+ ),
42
+ filemtime( plugin_dir_path( __FILE__ ) . 'sync-connection-error-filter/index.js' ),
43
+ true
44
+ );
45
+ }
46
+
47
+ add_action( 'enqueue_block_editor_assets', 'enqueue_sync_connection_error_filter_scripts' );