-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format library: fix unsetting highlight color (#37062)
- Loading branch information
Showing
4 changed files
with
72 additions
and
9 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
packages/e2e-tests/specs/editor/various/format-library/__snapshots__/text-color.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`RichText should remove highlighting element 1`] = ` | ||
"<!-- wp:paragraph --> | ||
<p><mark style=\\"background-color:rgba(0, 0, 0, 0)\\" class=\\"has-inline-color has-cyan-bluish-gray-color\\">1</mark></p> | ||
<!-- /wp:paragraph -->" | ||
`; | ||
exports[`RichText should remove highlighting element 2`] = ` | ||
"<!-- wp:paragraph --> | ||
<p>1</p> | ||
<!-- /wp:paragraph -->" | ||
`; |
46 changes: 46 additions & 0 deletions
46
packages/e2e-tests/specs/editor/various/format-library/text-color.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { | ||
createNewPost, | ||
getEditedPostContent, | ||
clickBlockAppender, | ||
pressKeyWithModifier, | ||
clickBlockToolbarButton, | ||
} from '@wordpress/e2e-test-utils'; | ||
|
||
describe( 'RichText', () => { | ||
beforeEach( async () => { | ||
await createNewPost(); | ||
} ); | ||
|
||
it( 'should remove highlighting element', async () => { | ||
await clickBlockAppender(); | ||
|
||
// Add text and select to color. | ||
await page.keyboard.type( '1' ); | ||
await pressKeyWithModifier( 'primary', 'a' ); | ||
await clickBlockToolbarButton( 'More' ); | ||
|
||
const button = await page.waitForXPath( | ||
`//button[text()='Highlight']` | ||
); | ||
// Clicks may fail if the button is out of view. Assure it is before click. | ||
await button.evaluate( ( element ) => element.scrollIntoView() ); | ||
await button.click(); | ||
|
||
// Use a color name with multiple words to ensure that it becomes | ||
// active. Previously we had a broken regular expression. | ||
const option = await page.waitForSelector( | ||
'[aria-label="Color: Cyan bluish gray"]' | ||
); | ||
|
||
await option.click(); | ||
|
||
expect( await getEditedPostContent() ).toMatchSnapshot(); | ||
|
||
await option.click(); | ||
|
||
expect( await getEditedPostContent() ).toMatchSnapshot(); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters