Skip to content
Open
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
b60c783
chore: migrate to tailwindcss@2.2.17
hperchec Dec 15, 2022
146afbe
feat: add themeClassPrefix plugin option + support for special charac…
hperchec Dec 15, 2022
9d798c8
test: add test for plugin option + special characters support
hperchec Dec 15, 2022
9e1679a
docs: update README
hperchec Dec 15, 2022
b3e27ce
build: update package.json
hperchec Apr 13, 2023
f0cb176
build: add support for Node v18
hperchec Apr 13, 2023
78662d1
docs: update README
hperchec Apr 13, 2023
bf6cdc4
build: update package.json
hperchec Apr 13, 2023
a505af1
wip: migrate to tailwindcss v3
hperchec Apr 30, 2025
f54e382
build: use juisy library
hperchec May 1, 2025
acf99d6
build: migrate from webpack to vite
hperchec May 1, 2025
88004f2
build: replace husky and commitizen by juisy features
hperchec May 1, 2025
1f6003f
feat: rewrite code in TypeScript and use new tailwind v3 plugin API
hperchec May 1, 2025
af7a40e
build: migrate to eslint v9 and use @stylistic rules
hperchec May 1, 2025
8411b8b
docs: update docs and licence
hperchec May 1, 2025
96fb3df
chore: remove postcss-selector-parser dependency
hperchec May 1, 2025
8dca335
docs: update simple example
hperchec May 1, 2025
828f9b7
build: update .gitignore file
hperchec May 5, 2025
3e17a47
test: migrate to vitest and rewrite tests
hperchec May 5, 2025
a552beb
build: remove useless files
hperchec May 5, 2025
fbdfbcc
docs: update docs
hperchec May 5, 2025
bbc7a83
build: update release config
hperchec May 5, 2025
d896ad3
build: update eslint config
hperchec May 5, 2025
49c9e79
chore: update simple example
hperchec May 5, 2025
58b966e
chore: update plugin
hperchec May 5, 2025
91d94ed
build: update package-lock.json
hperchec May 5, 2025
db00188
ci: update .travis.yml
hperchec May 5, 2025
aee56b5
docs: update contributing
hperchec May 5, 2025
8c4294f
build: add @release-it/conventional-changelog dependency
hperchec May 5, 2025
c965451
style: lint files
hperchec May 5, 2025
dc81ecf
build: use master branch instead of main in release config
hperchec May 5, 2025
0daeaa2
test: remove console.log
hperchec May 5, 2025
daf47a2
build: update package-lock.json
hperchec May 5, 2025
010ee18
build: update release config
hperchec May 5, 2025
2615a07
build: update release config
hperchec May 5, 2025
30f41f4
chore(release): v2.0.0
hperchec May 5, 2025
8079133
build: remove old external dep
hperchec May 5, 2025
6fcb7e0
docs: update readme template
hperchec May 5, 2025
9376920
build: update package.json files field
hperchec May 5, 2025
f7f36b8
chore(release): v2.0.1
hperchec May 5, 2025
5f41f7f
docs: add -D option to npm install command in README file
hperchec Jun 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: add test for plugin option + special characters support
  • Loading branch information
hperchec committed Dec 15, 2022
commit 9d798c896065e6872f12ed6c41425f5ce8520ba5
48 changes: 46 additions & 2 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import postcss from 'postcss'
import tailwindcss from 'tailwindcss'
import plugin from '../src/index'

const generatePluginCss = (config = {}) => {
const generatePluginCss = (config = {}, pluginOptions = {}) => {
return postcss(
tailwindcss({
theme: {},
corePlugins: false,
plugins: [plugin],
plugins: [plugin(pluginOptions)],
...config,
})
)
Expand Down Expand Up @@ -64,6 +64,32 @@ describe('plugin', () => {
})
})

it('should accept allowed characters for css identifiers in theme variant name and escape it', () => {
return generatePluginCss({
...baseTestTheme,
theme: {
themeVariants: ['@dark'],
colors: {
gray: {
'100': '#333333',
},
}
},
variants: {
textColor: ['@dark'],
},
}).then((css) => {
expect(css).toMatchCss(`
.text-gray-100 {
color: #333333
}
.theme-\\@dark .\\@dark\\:text-gray-100 {
color: #333333
}
`)
})
})

it('should generate base classes variants', () => {
return generatePluginCss({
...baseTestTheme,
Expand Down Expand Up @@ -326,4 +352,22 @@ describe('plugin', () => {
`)
})
})

it('should process themeClassPrefix plugin option and adapt class names', () => {
return generatePluginCss({
...baseTestTheme,
variants: {
textColor: ['dark'],
},
}, { themeClassPrefix: 'prefix_' }).then((css) => {
expect(css).toMatchCss(`
.text-gray-100 {
color: #333333
}
.prefix_dark .dark\\:text-gray-100 {
color: #333333
}
`)
})
})
})