mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Make second parameter to className optional
This commit is contained in:
parent
c6ae957aff
commit
8fb2351463
@ -633,6 +633,30 @@ test('plugins can create class names accounting for special naming rules easily'
|
||||
`)
|
||||
})
|
||||
|
||||
test('the second parameter in className is optional', () => {
|
||||
const { components, utilities } = processPlugins(
|
||||
[
|
||||
function({ className, addUtilities }) {
|
||||
addUtilities({
|
||||
[className('rotate')]: {
|
||||
transform: 'rotate(180deg)',
|
||||
},
|
||||
})
|
||||
},
|
||||
],
|
||||
makeConfig()
|
||||
)
|
||||
|
||||
expect(components.length).toBe(0)
|
||||
expect(css(utilities)).toMatchCss(`
|
||||
@variants {
|
||||
.rotate {
|
||||
transform: rotate(180deg)
|
||||
}
|
||||
}
|
||||
`)
|
||||
})
|
||||
|
||||
test('plugins can access the current config', () => {
|
||||
const { components, utilities } = processPlugins(
|
||||
[
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import _ from 'lodash'
|
||||
import escapeClassName from './escapeClassName'
|
||||
|
||||
export default function className(base, modifier) {
|
||||
export default function className(base, modifier = 'default') {
|
||||
const name = (() => {
|
||||
if (modifier === 'default') {
|
||||
return base
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user