@wordpress/e2e-tests 7.6.8 → 7.6.10
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": "7.6.
|
3
|
+
"version": "7.6.10",
|
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,7 +23,7 @@
|
|
23
23
|
"node": ">=14"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@wordpress/e2e-test-utils": "^10.6.
|
26
|
+
"@wordpress/e2e-test-utils": "^10.6.4",
|
27
27
|
"@wordpress/jest-console": "^7.6.1",
|
28
28
|
"@wordpress/jest-puppeteer-axe": "^6.6.1",
|
29
29
|
"@wordpress/scripts": "^26.6.3",
|
@@ -45,5 +45,5 @@
|
|
45
45
|
"publishConfig": {
|
46
46
|
"access": "public"
|
47
47
|
},
|
48
|
-
"gitHead": "
|
48
|
+
"gitHead": "ec0ed708e46a598ab2cf8e18bf2591b0102b5bb3"
|
49
49
|
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Plugin Name: Gutenberg Test Iframed enqueue block editor settings
|
4
|
+
* Plugin URI: https://github.com/WordPress/gutenberg
|
5
|
+
* Author: Gutenberg Team
|
6
|
+
*
|
7
|
+
* @package gutenberg-test-iframed-iframed-enqueue-block-editor-settings
|
8
|
+
*/
|
9
|
+
|
10
|
+
add_action(
|
11
|
+
'block_editor_settings_all',
|
12
|
+
function( $settings ) {
|
13
|
+
$settings['styles'][] = array(
|
14
|
+
'css' => 'p { border: 1px solid red }',
|
15
|
+
'__unstableType' => 'plugin',
|
16
|
+
);
|
17
|
+
return $settings;
|
18
|
+
}
|
19
|
+
);
|
@@ -0,0 +1,108 @@
|
|
1
|
+
/**
|
2
|
+
* WordPress dependencies
|
3
|
+
*/
|
4
|
+
import {
|
5
|
+
activatePlugin,
|
6
|
+
createNewPost,
|
7
|
+
deactivatePlugin,
|
8
|
+
canvas,
|
9
|
+
activateTheme,
|
10
|
+
} from '@wordpress/e2e-test-utils';
|
11
|
+
|
12
|
+
async function getComputedStyle( context, selector, property ) {
|
13
|
+
return await context.evaluate(
|
14
|
+
( sel, prop ) =>
|
15
|
+
window.getComputedStyle( document.querySelector( sel ) )[ prop ],
|
16
|
+
selector,
|
17
|
+
property
|
18
|
+
);
|
19
|
+
}
|
20
|
+
|
21
|
+
describe( 'iframed block editor settings styles', () => {
|
22
|
+
beforeEach( async () => {
|
23
|
+
// Activate the empty theme (block based theme), which is iframed.
|
24
|
+
await activateTheme( 'emptytheme' );
|
25
|
+
await activatePlugin(
|
26
|
+
'gutenberg-test-iframed-enqueue-block-editor-settings'
|
27
|
+
);
|
28
|
+
await createNewPost();
|
29
|
+
} );
|
30
|
+
|
31
|
+
afterEach( async () => {
|
32
|
+
await deactivatePlugin(
|
33
|
+
'gutenberg-test-iframed-enqueue-block-editor-settings'
|
34
|
+
);
|
35
|
+
await activateTheme( 'twentytwentyone' );
|
36
|
+
} );
|
37
|
+
|
38
|
+
it( 'should load styles added through block editor settings', async () => {
|
39
|
+
await page.waitForSelector( 'iframe[name="editor-canvas"]' );
|
40
|
+
// Expect a red border (added in PHP).
|
41
|
+
expect( await getComputedStyle( canvas(), 'p', 'border-color' ) ).toBe(
|
42
|
+
'rgb(255, 0, 0)'
|
43
|
+
);
|
44
|
+
|
45
|
+
await page.evaluate( () => {
|
46
|
+
const settings = window.wp.data
|
47
|
+
.select( 'core/editor' )
|
48
|
+
.getEditorSettings();
|
49
|
+
wp.data.dispatch( 'core/editor' ).updateEditorSettings( {
|
50
|
+
...settings,
|
51
|
+
styles: [
|
52
|
+
...settings.styles,
|
53
|
+
{
|
54
|
+
css: 'p { border-width: 2px; }',
|
55
|
+
__unstableType: 'plugin',
|
56
|
+
},
|
57
|
+
],
|
58
|
+
} );
|
59
|
+
} );
|
60
|
+
|
61
|
+
// Expect a 2px border (added in JS).
|
62
|
+
expect( await getComputedStyle( canvas(), 'p', 'border-width' ) ).toBe(
|
63
|
+
'2px'
|
64
|
+
);
|
65
|
+
} );
|
66
|
+
|
67
|
+
it( 'should load theme styles added through block editor settings', async () => {
|
68
|
+
await page.waitForSelector( 'iframe[name="editor-canvas"]' );
|
69
|
+
|
70
|
+
await page.evaluate( () => {
|
71
|
+
// Make sure that theme styles are added even if the theme styles
|
72
|
+
// preference is off.
|
73
|
+
window.wp.data
|
74
|
+
.dispatch( 'core/edit-post' )
|
75
|
+
.toggleFeature( 'themeStyles' );
|
76
|
+
const settings = window.wp.data
|
77
|
+
.select( 'core/editor' )
|
78
|
+
.getEditorSettings();
|
79
|
+
wp.data.dispatch( 'core/editor' ).updateEditorSettings( {
|
80
|
+
...settings,
|
81
|
+
styles: [
|
82
|
+
...settings.styles,
|
83
|
+
{
|
84
|
+
css: 'p { border-width: 2px; }',
|
85
|
+
__unstableType: 'theme',
|
86
|
+
},
|
87
|
+
],
|
88
|
+
} );
|
89
|
+
} );
|
90
|
+
|
91
|
+
// Expect a 1px border because theme styles are disabled.
|
92
|
+
expect( await getComputedStyle( canvas(), 'p', 'border-width' ) ).toBe(
|
93
|
+
'1px'
|
94
|
+
);
|
95
|
+
|
96
|
+
await page.evaluate( () => {
|
97
|
+
// Now enable theme styles.
|
98
|
+
window.wp.data
|
99
|
+
.dispatch( 'core/edit-post' )
|
100
|
+
.toggleFeature( 'themeStyles' );
|
101
|
+
} );
|
102
|
+
|
103
|
+
// Expect a 2px border because theme styles are enabled.
|
104
|
+
expect( await getComputedStyle( canvas(), 'p', 'border-width' ) ).toBe(
|
105
|
+
'2px'
|
106
|
+
);
|
107
|
+
} );
|
108
|
+
} );
|
@@ -23,8 +23,6 @@ const reusableBlockNameInputSelector =
|
|
23
23
|
'.reusable-blocks-menu-items__convert-modal .components-text-control__input';
|
24
24
|
const reusableBlockInspectorNameInputSelector =
|
25
25
|
'.block-editor-block-inspector .components-text-control__input';
|
26
|
-
const syncToggleSelector =
|
27
|
-
'.reusable-blocks-menu-items__convert-modal .components-form-toggle__input';
|
28
26
|
const syncToggleSelectorChecked =
|
29
27
|
'.reusable-blocks-menu-items__convert-modal .components-form-toggle.is-checked';
|
30
28
|
|
@@ -205,8 +203,6 @@ describe( 'Reusable blocks', () => {
|
|
205
203
|
);
|
206
204
|
await nameInput.click();
|
207
205
|
await page.keyboard.type( 'Multi-selection reusable block' );
|
208
|
-
const syncToggle = await page.waitForSelector( syncToggleSelector );
|
209
|
-
syncToggle.click();
|
210
206
|
await page.waitForSelector( syncToggleSelectorChecked );
|
211
207
|
await page.keyboard.press( 'Enter' );
|
212
208
|
|
@@ -389,8 +385,6 @@ describe( 'Reusable blocks', () => {
|
|
389
385
|
);
|
390
386
|
await nameInput.click();
|
391
387
|
await page.keyboard.type( 'Block with styles' );
|
392
|
-
const syncToggle = await page.waitForSelector( syncToggleSelector );
|
393
|
-
syncToggle.click();
|
394
388
|
await page.waitForSelector( syncToggleSelectorChecked );
|
395
389
|
await page.keyboard.press( 'Enter' );
|
396
390
|
const reusableBlock = await canvas().waitForSelector(
|