Skip to content

Commit

Permalink
Update postcss-prefixwrap dependency to 1.51.0 to fix prefixing in :w…
Browse files Browse the repository at this point in the history
…here selectors
  • Loading branch information
talldan committed Aug 13, 2024
1 parent d34ddd4 commit eb09413
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 16 deletions.
31 changes: 16 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/block-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"fast-deep-equal": "^3.1.3",
"memize": "^2.1.0",
"postcss": "^8.4.21",
"postcss-prefixwrap": "^1.41.0",
"postcss-prefixwrap": "^1.51.0",
"postcss-urlrebase": "^1.4.0",
"react-autosize-textarea": "^7.1.0",
"react-easy-crop": "^5.0.6",
Expand Down
32 changes: 32 additions & 0 deletions packages/block-editor/src/utils/test/transform-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,21 @@ describe( 'transformStyles', () => {
expect( output ).toMatchSnapshot();
} );

it( `should not try to replace 'body' in the middle of a classname`, () => {
const prefix = '.my-namespace';
const input = `.has-body-text { color: red; }`;
const output = transformStyles(
[
{
css: input,
},
],
prefix
);

expect( output ).toEqual( [ `${ prefix } ${ input }` ] );
} );

it( 'should ignore keyframes', () => {
const input = `
@keyframes edit-post__fade-in-animation {
Expand Down Expand Up @@ -210,6 +225,23 @@ describe( 'transformStyles', () => {

expect( output ).toMatchSnapshot();
} );

it( 'should not try to wrap items within `:where` selectors', () => {
const input = `:where(.wp-element-button:active, .wp-block-button__link:active) { color: blue; }`;
const prefix = '.my-namespace';
const expected = [ `${ prefix } ${ input }` ];

const output = transformStyles(
[
{
css: input,
},
],
prefix
);

expect( output ).toEqual( expected );
} );
} );

it( 'should not break with data urls', () => {
Expand Down

0 comments on commit eb09413

Please sign in to comment.