-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest.js
34 lines (30 loc) · 928 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const cssMatcher = require('jest-matcher-css')
const plugin = require('./index')
const { run } = require('../../testing/run')
expect.extend({
toMatchCss: cssMatcher,
})
it('should generate the parent-expanded classes', () => {
const config = {
content: [
{
raw: String.raw`
<button aria-expanded="true">
<span class="parent-expanded:rotate-180">></span>
</button>
`,
},
],
}
const output = String.raw`
[aria-expanded="true"] .parent-expanded\:rotate-180 {
--tw-rotate: 180deg;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
}
`
expect.assertions(2)
return run(plugin, config).then((result) => {
expect(result.warnings().length).toBe(0)
expect(result.css).toMatchCss(output)
})
})