Skip to content

Commit

Permalink
Add test case for old text color format
Browse files Browse the repository at this point in the history
  • Loading branch information
fluiddot committed Feb 9, 2022
1 parent 3076182 commit 3d970a0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,13 @@ exports[`Text color creates a paragraph block with the text color format 1`] = `
<p>Hello <mark style=\\"background-color:rgba(0,0,0,0);color:#cf2e2e\\" class=\\"has-inline-color has-vivid-red-color\\">this is a test</mark></p>
<!-- /wp:paragraph -->"
`;
exports[`Text color supports old text color format using "span" tag 1`] = `
"<!-- wp:paragraph -->
<p>this <span class=\\"has-inline-color has-green-color\\">is</span> <span class=\\"has-inline-color has-red-color\\">test</span></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p><span style=\\"color:#08a5e9\\" class=\\"has-inline-color\\">this is a test</span></p>
<!-- /wp:paragraph -->"
`;
14 changes: 14 additions & 0 deletions packages/format-library/src/text-color/test/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,18 @@ describe( 'Text color', () => {

expect( getEditorHtml() ).toMatchSnapshot();
} );

it( 'supports old text color format using "span" tag', async () => {
await initializeEditor( {
initialHtml: `<!-- wp:paragraph -->
<p>this <span class="has-inline-color has-green-color">is</span> <span class="has-inline-color has-red-color">test</span></p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p><span style="color:#08a5e9" class="has-inline-color">this is a test</span></p>
<!-- /wp:paragraph -->`,
} );

expect( getEditorHtml() ).toMatchSnapshot();
} );
} );

0 comments on commit 3d970a0

Please sign in to comment.