diff --git a/__tests__/processPlugins.test.js b/__tests__/processPlugins.test.js index 048f2415e..fb445a83b 100644 --- a/__tests__/processPlugins.test.js +++ b/__tests__/processPlugins.test.js @@ -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( [ diff --git a/src/util/className.js b/src/util/className.js index 9f417ed2b..b91465039 100644 --- a/src/util/className.js +++ b/src/util/className.js @@ -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