Skip to content
This repository was archived by the owner on Dec 15, 2024. It is now read-only.

Commit 0136138

Browse files
committed
Test the className option
1 parent 5ae5f76 commit 0136138

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

test.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const postcss = require('postcss');
44
const tailwindcss = require('tailwindcss');
55
const altPlugin = require('./index.js');
66

7-
const generatePluginCss = (variants = []) => {
7+
const generatePluginCss = (variants = [], pluginOptions = {}) => {
88
return postcss(
99
tailwindcss({
1010
theme: {
@@ -14,8 +14,8 @@ const generatePluginCss = (variants = []) => {
1414
},
1515
corePlugins: false,
1616
plugins: [
17-
altPlugin(),
18-
({ e, addUtilities }) => {
17+
altPlugin(pluginOptions),
18+
({ addUtilities }) => {
1919
addUtilities({
2020
'.block': {
2121
'display': 'block',
@@ -227,3 +227,24 @@ test('all variants can be chained with the responsive variant', () => {
227227
`);
228228
});
229229
});
230+
231+
test('the alt class name can be customized', () => {
232+
return generatePluginCss(['alt', 'alt-hover', 'alt-group-focus-within'], {
233+
className: 'special',
234+
}).then(css => {
235+
expect(css).toMatchCss(`
236+
.block {
237+
display: block;
238+
}
239+
.special .special\\:block {
240+
display: block;
241+
}
242+
.special .special\\:hover\\:block:hover {
243+
display: block;
244+
}
245+
.special .group:focus-within .special\\:group-focus-within\\:block {
246+
display: block;
247+
}
248+
`);
249+
});
250+
});

0 commit comments

Comments
 (0)