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

E2E Tests - Adds more Highlight color visual tests #6830

Merged
merged 1 commit into from
Apr 25, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -459,5 +459,55 @@ describe( 'Gutenberg Editor - Test Suite 1', () => {
screenshot = await takeScreenshotByElement( paragraphBlockElement );
expect( screenshot ).toMatchImageSnapshot();
} );

it( 'should set a shorthand hex highlight color', async () => {
await editorPage.initializeEditor( {
rawFeatures:
'{"color":{"background":true,"custom":true,"palette":{"theme":[{"color":"#6a8cd0","name":"Base","slug":"base"},{"color":"#000","name":"Tertiary","slug":"tertiary"}]},"text":true}}',
rawStyles:
'{"color":{"background":"var(--wp--preset--color--base)","text":"var(--wp--preset--color--tertiary)"}}',
} );

const defaultBlockAppenderElement =
await editorPage.getDefaultBlockAppenderElement();
await defaultBlockAppenderElement.click();
const toolbar = await editorPage.getToolbar();

await editorPage.toggleHighlightColor( 'Tertiary' );

await editorPage.typeKeyString( 'Hey ' );

screenshot = await takeScreenshotByElement(
await toolbar.$( '~Text color' ),
{ padding: -5 }
);
expect( screenshot ).toMatchImageSnapshot();

const paragraphBlockElement = await editorPage.getBlockAtPosition(
blockNames.paragraph
);

await editorPage.dismissKeyboard();
await editorPage.driver.waitUntil( async function () {
return ! ( await editorPage.driver.isKeyboardShown() );
} );

screenshot = await takeScreenshotByElement( paragraphBlockElement );
expect( screenshot ).toMatchImageSnapshot();
} );

it( 'should render a mark tag with shorthand hex highlight color', async () => {
await editorPage.initializeEditor( {
initialData: `<!-- wp:paragraph -->
<p><mark style="background-color:rgba(0,0,0,0);color:#000" class="has-inline-color has-black-color">Hey</mark></p>
<!-- /wp:paragraph -->`,
} );

const paragraphBlockElement = await editorPage.getBlockAtPosition(
blockNames.paragraph
);
screenshot = await takeScreenshotByElement( paragraphBlockElement );
expect( screenshot ).toMatchImageSnapshot();
} );
} );
} );
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading