ensure we don't override the name (#5602)
Keep track of unknown values (like css variables) in an unknown section. Currently we only need to know the name, so this will be good enough for now.
This commit is contained in:
parent
c03f9ad600
commit
4cb1de0f01
2 changed files with 20 additions and 1 deletions
|
|
@ -54,7 +54,13 @@ export default function parseAnimationValue(input) {
|
|||
} else if (!seen.has('DELAY') && TIME.test(part)) {
|
||||
result.delay = part
|
||||
seen.add('DELAY')
|
||||
} else result.name = part
|
||||
} else if (!seen.has('NAME')) {
|
||||
result.name = part
|
||||
seen.add('NAME')
|
||||
} else {
|
||||
if (!result.unknown) result.unknown = []
|
||||
result.unknown.push(part)
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
|
|
|
|||
|
|
@ -38,6 +38,19 @@ describe('Tailwind Defaults', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('css variables', () => {
|
||||
it('should be possible to use css variables', () => {
|
||||
let parsed = parseAnimationValue('jump var(--animation-duration, 10s) linear infinite')
|
||||
expect(parsed[0]).toEqual({
|
||||
value: 'jump var(--animation-duration, 10s) linear infinite',
|
||||
name: 'jump',
|
||||
timingFunction: 'linear',
|
||||
iterationCount: 'infinite',
|
||||
unknown: ['var(--animation-duration, 10s)'],
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('MDN Examples', () => {
|
||||
it.each([
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue