@wordpress/e2e-tests 7.25.0 → 7.27.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 +9 -9
- package/plugins/delete-installed-fonts.php +68 -0
- package/plugins/interactive-blocks/directive-on/render.php +20 -0
- package/plugins/interactive-blocks/directive-on/view.js +12 -0
- package/plugins/plugins-api/annotations-sidebar.js +2 -2
- package/plugins/plugins-api/document-setting.js +1 -1
- package/plugins/plugins-api/post-status-info.js +1 -1
- package/plugins/plugins-api/publish-panel.js +2 -2
- package/plugins/plugins-api/sidebar.js +2 -2
- package/plugins/plugins-api.php +5 -5
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.27.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,13 +23,13 @@
|
|
23
23
|
"node": ">=14"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@wordpress/e2e-test-utils": "^10.
|
27
|
-
"@wordpress/interactivity": "^5.
|
28
|
-
"@wordpress/interactivity-router": "^1.
|
29
|
-
"@wordpress/jest-console": "^7.
|
30
|
-
"@wordpress/jest-puppeteer-axe": "^6.
|
31
|
-
"@wordpress/scripts": "^27.
|
32
|
-
"@wordpress/url": "^3.
|
26
|
+
"@wordpress/e2e-test-utils": "^10.27.0",
|
27
|
+
"@wordpress/interactivity": "^5.5.0",
|
28
|
+
"@wordpress/interactivity-router": "^1.6.0",
|
29
|
+
"@wordpress/jest-console": "^7.27.0",
|
30
|
+
"@wordpress/jest-puppeteer-axe": "^6.27.0",
|
31
|
+
"@wordpress/scripts": "^27.7.0",
|
32
|
+
"@wordpress/url": "^3.57.0",
|
33
33
|
"chalk": "^4.0.0",
|
34
34
|
"expect-puppeteer": "^4.4.0",
|
35
35
|
"filenamify": "^4.2.0",
|
@@ -46,5 +46,5 @@
|
|
46
46
|
"publishConfig": {
|
47
47
|
"access": "public"
|
48
48
|
},
|
49
|
-
"gitHead": "
|
49
|
+
"gitHead": "280403b4c1cf6cc2c55a6c4d56f9ef91145e4191"
|
50
50
|
}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Plugin Name: Gutenberg Test Delete Installed Fonts
|
4
|
+
* Plugin URI: https://github.com/WordPress/gutenberg
|
5
|
+
* Author: Gutenberg Team
|
6
|
+
*
|
7
|
+
* @package gutenberg-test-delete-installed-fonts
|
8
|
+
*/
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Saves a randomly generated temporary font directory to use for e2e tests.
|
12
|
+
*/
|
13
|
+
function gutenberg_e2e_set_temp_font_dir() {
|
14
|
+
update_option( 'gutenberg_e2e_font_dir', '/e2e_fonts_' . wp_generate_uuid4() );
|
15
|
+
}
|
16
|
+
register_activation_hook( __FILE__, 'gutenberg_e2e_set_temp_font_dir' );
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Uses the randomly generated font directory for the duration of the font tests.
|
20
|
+
*/
|
21
|
+
function gutenberg_filter_e2e_font_dir( $font_dir ) {
|
22
|
+
$subdir = get_option( 'gutenberg_e2e_font_dir' );
|
23
|
+
|
24
|
+
$font_dir['path'] .= $subdir;
|
25
|
+
$font_dir['url'] .= $subdir;
|
26
|
+
$font_dir['basedir'] .= $subdir;
|
27
|
+
$font_dir['baseurl'] .= $subdir;
|
28
|
+
|
29
|
+
return $font_dir;
|
30
|
+
}
|
31
|
+
add_filter( 'font_dir', 'gutenberg_filter_e2e_font_dir' );
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Deletes all user installed fonts, associated font files, the fonts directory, and user global styles typography
|
35
|
+
* setings for the current theme so that we can test uploading/installing fonts in a clean environment.
|
36
|
+
*/
|
37
|
+
function gutenberg_delete_installed_fonts() {
|
38
|
+
$font_family_ids = new WP_Query(
|
39
|
+
array(
|
40
|
+
'post_type' => 'wp_font_family',
|
41
|
+
'posts_per_page' => -1,
|
42
|
+
'fields' => 'ids',
|
43
|
+
)
|
44
|
+
);
|
45
|
+
|
46
|
+
// Delete all font families, their child font faces, and associated font files.
|
47
|
+
foreach ( $font_family_ids->posts as $font_family_id ) {
|
48
|
+
wp_delete_post( $font_family_id, true );
|
49
|
+
}
|
50
|
+
|
51
|
+
// Delete the font directory, which should now be empty.
|
52
|
+
$font_path = wp_get_font_dir()['path'];
|
53
|
+
|
54
|
+
if ( is_dir( $font_path ) ) {
|
55
|
+
rmdir( $font_path );
|
56
|
+
}
|
57
|
+
|
58
|
+
// Delete any installed fonts from global styles.
|
59
|
+
$global_styles_post_id = WP_Theme_JSON_Resolver::get_user_global_styles_post_id();
|
60
|
+
$request = new WP_REST_Request( 'POST', '/wp/v2/global-styles/' . $global_styles_post_id );
|
61
|
+
$request->set_body_params( array( 'settings' => array( 'typography' => array( 'fontFamilies' => array() ) ) ) );
|
62
|
+
|
63
|
+
rest_do_request( $request );
|
64
|
+
}
|
65
|
+
|
66
|
+
// Clean up fonts on plugin activation and deactivation.
|
67
|
+
register_activation_hook( __FILE__, 'gutenberg_delete_installed_fonts' );
|
68
|
+
register_deactivation_hook( __FILE__, 'gutenberg_delete_installed_fonts' );
|
@@ -49,4 +49,24 @@
|
|
49
49
|
data-wp-on--click="actions.clickHandler"
|
50
50
|
>Click me!</button>
|
51
51
|
</div>
|
52
|
+
<div data-wp-context='{"clicked":false,"clickCount":0,"isOpen":true}'>
|
53
|
+
<p
|
54
|
+
data-wp-text="context.clicked"
|
55
|
+
data-testid="multiple handlers clicked"
|
56
|
+
>false</p>
|
57
|
+
<p
|
58
|
+
data-wp-text="context.clickCount"
|
59
|
+
data-testid="multiple handlers clickCount"
|
60
|
+
>0</p>
|
61
|
+
<p
|
62
|
+
data-wp-text="context.isOpen"
|
63
|
+
data-testid="multiple handlers isOpen"
|
64
|
+
>true</p>
|
65
|
+
<button
|
66
|
+
data-testid="multiple handlers button"
|
67
|
+
data-wp-on--click="actions.setClicked"
|
68
|
+
data-wp-on--click--counter="actions.countClick"
|
69
|
+
data-wp-on--click--toggle="actions.toggle"
|
70
|
+
>Click me!</button>
|
71
|
+
</div>
|
52
72
|
</div>
|
@@ -26,5 +26,17 @@ const { state } = store( 'directive-on', {
|
|
26
26
|
const context = getContext();
|
27
27
|
context.customEvents += 1;
|
28
28
|
},
|
29
|
+
setClicked: () => {
|
30
|
+
const context = getContext();
|
31
|
+
context.clicked = true;
|
32
|
+
},
|
33
|
+
countClick: () => {
|
34
|
+
const context = getContext();
|
35
|
+
context.clickCount += 1;
|
36
|
+
},
|
37
|
+
toggle: () => {
|
38
|
+
const context = getContext();
|
39
|
+
context.isOpen = ! context.isOpen;
|
40
|
+
},
|
29
41
|
},
|
30
42
|
} );
|
@@ -8,8 +8,8 @@
|
|
8
8
|
const Component = wp.element.Component;
|
9
9
|
const __ = wp.i18n.__;
|
10
10
|
const registerPlugin = wp.plugins.registerPlugin;
|
11
|
-
const PluginSidebar = wp.
|
12
|
-
const PluginSidebarMoreMenuItem = wp.
|
11
|
+
const PluginSidebar = wp.editor.PluginSidebar;
|
12
|
+
const PluginSidebarMoreMenuItem = wp.editor.PluginSidebarMoreMenuItem;
|
13
13
|
|
14
14
|
class SidebarContents extends Component {
|
15
15
|
constructor( props ) {
|
@@ -2,7 +2,7 @@
|
|
2
2
|
const el = wp.element.createElement;
|
3
3
|
const __ = wp.i18n.__;
|
4
4
|
const registerPlugin = wp.plugins.registerPlugin;
|
5
|
-
const PluginDocumentSettingPanel = wp.
|
5
|
+
const PluginDocumentSettingPanel = wp.editor.PluginDocumentSettingPanel;
|
6
6
|
|
7
7
|
function MyDocumentSettingPlugin() {
|
8
8
|
return el(
|
@@ -2,7 +2,7 @@
|
|
2
2
|
const el = wp.element.createElement;
|
3
3
|
const __ = wp.i18n.__;
|
4
4
|
const registerPlugin = wp.plugins.registerPlugin;
|
5
|
-
const PluginPostStatusInfo = wp.
|
5
|
+
const PluginPostStatusInfo = wp.editor.PluginPostStatusInfo;
|
6
6
|
|
7
7
|
function MyPostStatusInfoPlugin() {
|
8
8
|
return el(
|
@@ -3,8 +3,8 @@
|
|
3
3
|
const Fragment = wp.element.Fragment;
|
4
4
|
const __ = wp.i18n.__;
|
5
5
|
const registerPlugin = wp.plugins.registerPlugin;
|
6
|
-
const PluginPostPublishPanel = wp.
|
7
|
-
const PluginPrePublishPanel = wp.
|
6
|
+
const PluginPostPublishPanel = wp.editor.PluginPostPublishPanel;
|
7
|
+
const PluginPrePublishPanel = wp.editor.PluginPrePublishPanel;
|
8
8
|
|
9
9
|
function PanelContent() {
|
10
10
|
return el( 'p', {}, __( 'Here is the panel content!' ) );
|
@@ -10,8 +10,8 @@
|
|
10
10
|
const el = wp.element.createElement;
|
11
11
|
const __ = wp.i18n.__;
|
12
12
|
const registerPlugin = wp.plugins.registerPlugin;
|
13
|
-
const PluginSidebar = wp.
|
14
|
-
const PluginSidebarMoreMenuItem = wp.
|
13
|
+
const PluginSidebar = wp.editor.PluginSidebar;
|
14
|
+
const PluginSidebarMoreMenuItem = wp.editor.PluginSidebarMoreMenuItem;
|
15
15
|
|
16
16
|
function SidebarContents() {
|
17
17
|
const postTitle = useSelect( ( select ) =>
|
package/plugins/plugins-api.php
CHANGED
@@ -15,7 +15,7 @@ function enqueue_plugins_api_plugin_scripts() {
|
|
15
15
|
'gutenberg-test-plugins-api-post-status-info',
|
16
16
|
plugins_url( 'plugins-api/post-status-info.js', __FILE__ ),
|
17
17
|
array(
|
18
|
-
'wp-
|
18
|
+
'wp-editor',
|
19
19
|
'wp-element',
|
20
20
|
'wp-i18n',
|
21
21
|
'wp-plugins',
|
@@ -28,7 +28,7 @@ function enqueue_plugins_api_plugin_scripts() {
|
|
28
28
|
'gutenberg-test-plugins-api-publish-pane;',
|
29
29
|
plugins_url( 'plugins-api/publish-panel.js', __FILE__ ),
|
30
30
|
array(
|
31
|
-
'wp-
|
31
|
+
'wp-editor',
|
32
32
|
'wp-element',
|
33
33
|
'wp-i18n',
|
34
34
|
'wp-plugins',
|
@@ -44,7 +44,7 @@ function enqueue_plugins_api_plugin_scripts() {
|
|
44
44
|
'wp-components',
|
45
45
|
'wp-compose',
|
46
46
|
'wp-data',
|
47
|
-
'wp-
|
47
|
+
'wp-editor',
|
48
48
|
'wp-block-editor',
|
49
49
|
'wp-editor',
|
50
50
|
'wp-element',
|
@@ -63,7 +63,7 @@ function enqueue_plugins_api_plugin_scripts() {
|
|
63
63
|
'wp-components',
|
64
64
|
'wp-compose',
|
65
65
|
'wp-data',
|
66
|
-
'wp-
|
66
|
+
'wp-editor',
|
67
67
|
'wp-block-editor',
|
68
68
|
'wp-element',
|
69
69
|
'wp-i18n',
|
@@ -78,7 +78,7 @@ function enqueue_plugins_api_plugin_scripts() {
|
|
78
78
|
'gutenberg-test-plugins-api-document-setting',
|
79
79
|
plugins_url( 'plugins-api/document-setting.js', __FILE__ ),
|
80
80
|
array(
|
81
|
-
'wp-
|
81
|
+
'wp-editor',
|
82
82
|
'wp-element',
|
83
83
|
'wp-i18n',
|
84
84
|
'wp-plugins',
|