-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b35af3
commit e2055c9
Showing
2 changed files
with
96 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import invokePlugin from '../util/invokePlugin' | ||
import plugin from '../../src/plugins/animation' | ||
|
||
test('defining animation and keyframes', () => { | ||
const config = { | ||
theme: { | ||
animation: { | ||
none: 'none', | ||
spin: 'spin 1s linear infinite', | ||
ping: 'ping 1s cubic-bezier(0, 0, 0.2, 1) infinite', | ||
}, | ||
keyframes: { | ||
spin: { to: { transform: 'rotate(360deg)' } }, | ||
ping: { '75%, 100%': { transform: 'scale(2)', opacity: '0' } }, | ||
}, | ||
}, | ||
variants: { | ||
animation: [], | ||
}, | ||
} | ||
|
||
const { utilities } = invokePlugin(plugin(), config) | ||
|
||
expect(utilities).toEqual([ | ||
[ | ||
{ | ||
'@keyframes ping': { '75%, 100%': { opacity: '0', transform: 'scale(2)' } }, | ||
'@keyframes spin': { to: { transform: 'rotate(360deg)' } }, | ||
}, | ||
{ respectImportant: false }, | ||
], | ||
[ | ||
{ | ||
'.animate-none': { animation: 'none' }, | ||
'.animate-ping': { animation: 'ping 1s cubic-bezier(0, 0, 0.2, 1) infinite' }, | ||
'.animate-spin': { animation: 'spin 1s linear infinite' }, | ||
}, | ||
[], | ||
], | ||
]) | ||
}) | ||
|
||
test('defining animation and keyframes with prefix', () => { | ||
const config = { | ||
prefix: 'tw-', | ||
theme: { | ||
animation: { | ||
none: 'none', | ||
spin: 'spin 1s linear infinite', | ||
ping: 'ping 1s cubic-bezier(0, 0, 0.2, 1) infinite', | ||
}, | ||
keyframes: { | ||
spin: { to: { transform: 'rotate(360deg)' } }, | ||
ping: { '75%, 100%': { transform: 'scale(2)', opacity: '0' } }, | ||
}, | ||
}, | ||
variants: { | ||
animation: [], | ||
}, | ||
} | ||
|
||
const { utilities } = invokePlugin(plugin(), config) | ||
|
||
expect(utilities).toEqual([ | ||
[ | ||
{ | ||
'@keyframes tw-ping': { '75%, 100%': { opacity: '0', transform: 'scale(2)' } }, | ||
'@keyframes tw-spin': { to: { transform: 'rotate(360deg)' } }, | ||
}, | ||
{ respectImportant: false }, | ||
], | ||
[ | ||
{ | ||
'.animate-none': { animation: 'none' }, | ||
'.animate-ping': { animation: 'tw-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite' }, | ||
'.animate-spin': { animation: 'tw-spin 1s linear infinite' }, | ||
}, | ||
[], | ||
], | ||
]) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters