-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.test.ts
37 lines (32 loc) · 980 Bytes
/
index.test.ts
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
35
36
37
import postcss from "postcss";
import tailwind, { Config } from "tailwindcss";
import plugin from "./index";
const html = String.raw;
const css = String.raw;
const generateConfig = (config: Config) => ({
theme: {},
plugins: [plugin],
...config,
});
const run = (config: Config, input: string) =>
postcss(tailwind(config)).process(input, { from: undefined });
describe("test aria-autocomplete-none", () => {
test("should generate correct css", async () => {
const config: Config = generateConfig({
content: [
{
raw: html`<div class="aria-autocomplete-none:bg-pink-600"></div>`,
},
],
});
const expected = css`
.aria-autocomplete-none\:bg-pink-600[aria-autocomplete="none"] {
--tw-bg-opacity: 1;
background-color: rgb(219 39 119 / var(--tw-bg-opacity));
}
`;
return run(config, "@tailwind utilities").then((result) =>
expect(result.css).toMatchCSS(expected)
);
});
});