Skip to content

Commit

Permalink
chore: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
zyyv committed May 6, 2024
1 parent 98d59c0 commit 17b77fa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/assets/output/preset-icons-propsProcessor.css

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

18 changes: 18 additions & 0 deletions test/preset-icons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,22 @@ describe('preset-icons', () => {
expect(css).toContain('data:image/svg+xml;utf8,%3Csvg')
await expect(css).toMatchFileSnapshot('./assets/output/preset-icons-unit-svg-prologue.css')
})

it('custom the usedProps in propsProcessor', async () => {
const uno = createGenerator({
presets: [
presetUno(),
presetIcons({
propsProcessor(props, collection, icon, svg, mode) {
if (mode === 'bg') {
delete props.width
delete props.height
}
},
}),
],
})
const { css } = await uno.generate(fixtures.join(' '), { preflights: false })
await expect(css).toMatchFileSnapshot('./assets/output/preset-icons-propsProcessor.css')
})
})

0 comments on commit 17b77fa

Please sign in to comment.