tailwindcss/tests/getClassList.test.js
Adam Wathan 97062c398b
Make negative values a first-class feature, rather than theme-driven (#5709)
* WIP

* Add failing test for negating default values

* Add dynamic negative value opt-in (#5713)

* Add `supportsNegativeValues` plugin option

* Update `getClassList` to support dynamic negative values

* Add test for using a negative scale value with a plugin that does not support dynamic negative values

* Support dynamic negation of `DEFAULT` values (#5718)

* Add test case

Co-authored-by: Brad Cornes <bradlc41@gmail.com>
2021-10-06 13:42:05 -04:00

27 lines
979 B
JavaScript

import resolveConfig from '../src/public/resolve-config'
import { createContext } from '../src/lib/setupContextUtils'
it('should generate every possible class, without variants', () => {
let config = {}
let context = createContext(resolveConfig(config))
expect(context.getClassList()).toBeInstanceOf(Array)
// Verify we have a `container` for the 'components' section.
expect(context.getClassList()).toContain('container')
// Verify we handle the DEFAULT case correctly
expect(context.getClassList()).toContain('border')
// Verify we handle negative values correctly
expect(context.getClassList()).toContain('-inset-1/4')
expect(context.getClassList()).toContain('-m-0')
expect(context.getClassList()).not.toContain('-uppercase')
expect(context.getClassList()).not.toContain('-opacity-50')
expect(
createContext(
resolveConfig({ theme: { extend: { margin: { DEFAULT: '5px' } } } })
).getClassList()
).not.toContain('-m-DEFAULT')
})