tailwindcss/tests/negateValue.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

15 lines
485 B
JavaScript

import negateValue from '../src/util/negateValue'
test('it negates numeric CSS values', () => {
expect(negateValue('5')).toEqual('-5')
expect(negateValue('10px')).toEqual('-10px')
expect(negateValue('18rem')).toEqual('-18rem')
expect(negateValue('-10')).toEqual('10')
expect(negateValue('-7ch')).toEqual('7ch')
})
test('values that cannot be negated become undefined', () => {
expect(negateValue('auto')).toBeUndefined()
expect(negateValue('cover')).toBeUndefined()
})