-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09432fd
commit f6c9253
Showing
2 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
7 changes: 5 additions & 2 deletions
7
packages/postcss-logical-fallback/src/utils/has-empty-child-nodes.ts
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import {Container} from "postcss"; | ||
import { Container } from 'postcss'; | ||
|
||
export const hasEmptyChildNodes = ({nodes}: Container) => !nodes || nodes.length === 0 | ||
export const hasEmptyChildNodes = ({ nodes }: Container) => { | ||
const significantNodes = nodes.filter((node) => node.type !== 'comment'); | ||
return !significantNodes || significantNodes.length === 0; | ||
}; |
38 changes: 38 additions & 0 deletions
38
packages/postcss-logical-fallback/tests/no-changes.test.ts
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,38 @@ | ||
import { test } from 'uvu'; | ||
import { run } from './run'; | ||
|
||
test('should not copy comments', async () => { | ||
await run( | ||
`body { | ||
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */ | ||
min-height: 100vh; | ||
padding: 2rem; | ||
}`, | ||
`body { | ||
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */ | ||
min-height: 100vh; | ||
padding: 2rem; | ||
}`, | ||
); | ||
|
||
await run( | ||
`.class { | ||
/* | ||
multiline | ||
comment | ||
*/ | ||
min-height: 100vh; | ||
padding: 2rem; | ||
}`, | ||
`.class { | ||
/* | ||
multiline | ||
comment | ||
*/ | ||
min-height: 100vh; | ||
padding: 2rem; | ||
}`, | ||
); | ||
}); | ||
|
||
test.run(); |