Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change console.error to console.warn for enqueued styles in the editor #35914

Merged
merged 4 commits into from
Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function styleSheetsCompat( doc ) {

if ( isMatch && ! doc.getElementById( ownerNode.id ) ) {
// eslint-disable-next-line no-console
console.error(
console.warn(
`Stylesheet ${ ownerNode.id } was not properly added.
For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).
For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe( 'iframed inline styles', () => {
'2px'
);

expect( console ).toHaveErrored(
expect( console ).toHaveWarned(
`Stylesheet iframed-inline-styles-compat-style-css was not properly added.
For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).
For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles). <link rel="stylesheet" id="iframed-inline-styles-compat-style-css" href="http://localhost:8889/wp-content/plugins/gutenberg-test-plugins/iframed-inline-styles/compat-style.css?ver=1626189899" media="all">`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ describe( 'iframed multiple block stylesheets', () => {

// Skip errors related to block-styles enqueing and the use of add_editor_style.
aristath marked this conversation as resolved.
Show resolved Hide resolved
// The issue is tracked on https://github.com/WordPress/gutenberg/issues/33212.
expect( console ).toHaveErrored();
expect( console ).toHaveWarned();
} );
} );
16 changes: 8 additions & 8 deletions packages/e2e-tests/specs/widgets/customizing-widgets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe( 'Widgets Customizer', () => {
selector: '.widget-content *',
} ).toBeFound( findOptions );

expect( console ).toHaveErrored( twentyTwentyError );
expect( console ).toHaveWarned( twentyTwentyError );
} );

it( 'should open the inspector panel', async () => {
Expand Down Expand Up @@ -250,7 +250,7 @@ describe( 'Widgets Customizer', () => {

await expect( inspectorHeading ).not.toBeVisible();

expect( console ).toHaveErrored( twentyTwentyError );
expect( console ).toHaveWarned( twentyTwentyError );
} );

it( 'should handle the inserter outer section', async () => {
Expand Down Expand Up @@ -359,7 +359,7 @@ describe( 'Widgets Customizer', () => {
level: 2,
} ).not.toBeFound();

expect( console ).toHaveErrored( twentyTwentyError );
expect( console ).toHaveWarned( twentyTwentyError );
} );

it( 'should move focus to the block', async () => {
Expand Down Expand Up @@ -456,7 +456,7 @@ describe( 'Widgets Customizer', () => {
} );
await expect( headingBlock ).toHaveFocus();

expect( console ).toHaveErrored( twentyTwentyError );
expect( console ).toHaveWarned( twentyTwentyError );
} );

it( 'should clear block selection', async () => {
Expand Down Expand Up @@ -520,7 +520,7 @@ describe( 'Widgets Customizer', () => {
name: 'Block tools',
} ).not.toBeFound();

expect( console ).toHaveErrored( twentyTwentyError );
expect( console ).toHaveWarned( twentyTwentyError );
} );

it( 'should handle legacy widgets', async () => {
Expand Down Expand Up @@ -700,7 +700,7 @@ describe( 'Widgets Customizer', () => {
} ).toBeFound();
await expect( paragraphBlock ).toBeVisible();

expect( console ).toHaveErrored( twentyTwentyError );
expect( console ).toHaveWarned( twentyTwentyError );
} );

it( 'should move (inner) blocks to another sidebar', async () => {
Expand Down Expand Up @@ -761,7 +761,7 @@ describe( 'Widgets Customizer', () => {
const movedParagraphBlock = await find( movedParagraphBlockQuery );
await expect( movedParagraphBlock ).toHaveFocus();

expect( console ).toHaveErrored( twentyTwentyError );
expect( console ).toHaveWarned( twentyTwentyError );
} );

it( 'should not render Block Settings sections', async () => {
Expand Down Expand Up @@ -852,7 +852,7 @@ describe( 'Widgets Customizer', () => {
level: 3,
} );

expect( console ).toHaveErrored( twentyTwentyError );
expect( console ).toHaveWarned( twentyTwentyError );
} );
} );

Expand Down
8 changes: 4 additions & 4 deletions packages/e2e-tests/specs/widgets/editing-widgets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ describe( 'Widgets screen', () => {
}
` );

expect( console ).toHaveErrored( twentyTwentyError );
expect( console ).toHaveWarned( twentyTwentyError );
} );

it.skip( 'Should insert content using the inline inserter', async () => {
Expand Down Expand Up @@ -602,7 +602,7 @@ describe( 'Widgets screen', () => {
].join( '\n' )
);

expect( console ).toHaveErrored( twentyTwentyError );
expect( console ).toHaveWarned( twentyTwentyError );
} );

it( 'Should display legacy widgets', async () => {
Expand Down Expand Up @@ -778,7 +778,7 @@ describe( 'Widgets screen', () => {
}
` );

expect( console ).toHaveErrored( twentyTwentyError );
expect( console ).toHaveWarned( twentyTwentyError );
} );

it( 'Allows widget deletion to be undone', async () => {
Expand Down Expand Up @@ -839,7 +839,7 @@ describe( 'Widgets screen', () => {
}
` );

expect( console ).toHaveErrored( twentyTwentyError );
expect( console ).toHaveWarned( twentyTwentyError );
} );

it( 'can toggle sidebar list view', async () => {
Expand Down