Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions packages/e2e-tests/plugins/iframed-inline-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
* @package gutenberg-test-iframed-inline-styles
*/

add_action(
'setup_theme',
static function () {
add_theme_support( 'block-templates' );
}
);

Comment on lines -10 to -16

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer needed as the editor canvas renders in iframed by default now.

add_action(
'init',
static function () {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'iframed inline styles', () => {
test.describe( 'iframed enqueue block assets', () => {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that there was a copy/paste issue when migrating this test.

test.beforeAll( async ( { requestUtils } ) => {
await Promise.all( [
requestUtils.activateTheme( 'emptytheme' ),
Expand Down
46 changes: 46 additions & 0 deletions test/e2e/specs/editor/plugins/iframed-inline-styles.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'iframed inline styles', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activatePlugin(
'gutenberg-test-iframed-inline-styles'
);
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deactivatePlugin(
'gutenberg-test-iframed-inline-styles'
);
} );

test( 'should load inline styles in iframe', async ( {
admin,
editor,
page,
} ) => {
let hasWarning;
page.on( 'console', ( msg ) => {
if ( msg.type() === 'warning' ) {
hasWarning = true;
}
} );

await admin.createNewPost( { postType: 'page' } );
await editor.insertBlock( { name: 'test/iframed-inline-styles' } );

const block = editor.canvas.getByRole( 'document', {
name: 'Block: Iframed Inline Styles',
} );
await expect( block ).toBeVisible();

// Inline styles of properly enqueued stylesheet should load.
await expect( block ).toHaveCSS( 'padding', '20px' );

// Inline styles of stylesheet loaded with the compatibility layer should load.
await expect( block ).toHaveCSS( 'border-width', '2px' );
expect( hasWarning ).toBe( true );

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be nice to at least know what warnings are being thrown, but not required in this PR as a part of the migration.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wanted to do that, but I decided to stick with linear migration for now 😅 Happy to follow up if this causes any flaky test reports.

By the way, Can we loosely assert array strings? e.g., Confirm array has value containing 'example' string?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! I think we can do .toEqual( expect.arrayContaining( [ ...stuff ] ) ).

} );
} );