2021-09-03 13:48:16 +02:00
|
|
|
import { run, html, css } from './util/run'
|
2021-08-16 17:25:30 +01:00
|
|
|
|
2021-08-21 03:39:06 +01:00
|
|
|
test('basic', () => {
|
2021-08-16 17:25:30 +01:00
|
|
|
let config = {
|
Remove AOT (#5340)
* make `jit` mode the default when no mode is specified
* unify JIT and AOT codepaths
* ensure `Object.entries` on undefined doesn't break
It could be that sometimes you don't have values in your config (e.g.: `presets: []`), this in turn will break some plugins where we assume we have a value.
* drop AOT specific tests
These tests are all covered by JIT mode already and were AOT specific.
* simplify tests, and add a few
Some of the tests were written for AOT specifically, some were missing. We also updated the way we write those tests, essentially making Tailwind a blackbox, by testing against the final output.
Now that JIT mode is the default, this is super fast because we only generate what is used, instead of partially testing in a 3MB file or building it all, then purging.
* add some todo's to make sure we warn in a few cases
* make `darkMode: 'media'`, the default
This also includes moving dark mode tests to its own dedicated file.
* remove PostCSS 7 compat mode
* update CLI to be JIT-first
* fix integration tests
This is not a _real_ fix, but it does solve the broken test for now.
* warn when using @responsive or @variants
* remove the JIT preview warning
* remove AOT-only code paths
* remove all `mode: 'jit'` blocks
Also remove `variants: {}` since they are not useful in `JIT` mode
anymore.
* drop unused dependencies
* rename `purge` to `content`
* remove static CDN builds
* mark `--purge` as deprecated in the CLI
This will still work, but a warning will be printed and it won't show up
in the `--help` output.
* cleanup nesting plugin
We don't have to duplicate it anymore since there is no PostCSS 7
version anymore.
* make sure integration tests run in band
* cleanup folder structure
* make sure nesting folder is available
* simplify resolving of purge/content information
2021-09-01 17:13:59 +02:00
|
|
|
content: [
|
2021-08-21 03:39:06 +01:00
|
|
|
{
|
2021-09-03 13:48:16 +02:00
|
|
|
raw: html`
|
2021-08-21 03:39:06 +01:00
|
|
|
<div class="animate-spin"></div>
|
|
|
|
|
<div class="hover:animate-ping"></div>
|
|
|
|
|
<div class="group-hover:animate-bounce"></div>
|
|
|
|
|
`,
|
|
|
|
|
},
|
|
|
|
|
],
|
2021-08-16 17:25:30 +01:00
|
|
|
}
|
|
|
|
|
|
2021-09-03 13:48:16 +02:00
|
|
|
return run('@tailwind utilities', config).then((result) => {
|
|
|
|
|
expect(result.css).toMatchFormattedCss(css`
|
2021-08-21 03:39:06 +01:00
|
|
|
@keyframes spin {
|
|
|
|
|
to {
|
|
|
|
|
transform: rotate(360deg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.animate-spin {
|
|
|
|
|
animation: spin 1s linear infinite;
|
|
|
|
|
}
|
|
|
|
|
@keyframes ping {
|
|
|
|
|
75%,
|
|
|
|
|
100% {
|
|
|
|
|
transform: scale(2);
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-18 12:08:48 +02:00
|
|
|
.hover\:animate-ping:hover {
|
2021-08-21 03:39:06 +01:00
|
|
|
animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
|
|
|
|
|
}
|
|
|
|
|
@keyframes bounce {
|
|
|
|
|
0%,
|
|
|
|
|
100% {
|
|
|
|
|
transform: translateY(-25%);
|
|
|
|
|
animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
|
|
|
|
|
}
|
|
|
|
|
50% {
|
|
|
|
|
transform: none;
|
|
|
|
|
animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-18 12:08:48 +02:00
|
|
|
.group:hover .group-hover\:animate-bounce {
|
2021-08-21 03:39:06 +01:00
|
|
|
animation: bounce 1s infinite;
|
|
|
|
|
}
|
|
|
|
|
`)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('custom', () => {
|
|
|
|
|
let config = {
|
2021-09-03 13:48:16 +02:00
|
|
|
content: [{ raw: html`<div class="animate-one"></div>` }],
|
2021-08-21 03:39:06 +01:00
|
|
|
theme: {
|
|
|
|
|
extend: {
|
|
|
|
|
keyframes: {
|
|
|
|
|
one: { to: { transform: 'rotate(360deg)' } },
|
|
|
|
|
},
|
|
|
|
|
animation: {
|
|
|
|
|
one: 'one 2s',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-03 13:48:16 +02:00
|
|
|
return run('@tailwind utilities', config).then((result) => {
|
|
|
|
|
expect(result.css).toMatchFormattedCss(css`
|
2021-08-21 03:39:06 +01:00
|
|
|
@keyframes one {
|
|
|
|
|
to {
|
|
|
|
|
transform: rotate(360deg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.animate-one {
|
|
|
|
|
animation: one 2s;
|
|
|
|
|
}
|
|
|
|
|
`)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('custom prefixed', () => {
|
|
|
|
|
let config = {
|
|
|
|
|
prefix: 'tw-',
|
Remove AOT (#5340)
* make `jit` mode the default when no mode is specified
* unify JIT and AOT codepaths
* ensure `Object.entries` on undefined doesn't break
It could be that sometimes you don't have values in your config (e.g.: `presets: []`), this in turn will break some plugins where we assume we have a value.
* drop AOT specific tests
These tests are all covered by JIT mode already and were AOT specific.
* simplify tests, and add a few
Some of the tests were written for AOT specifically, some were missing. We also updated the way we write those tests, essentially making Tailwind a blackbox, by testing against the final output.
Now that JIT mode is the default, this is super fast because we only generate what is used, instead of partially testing in a 3MB file or building it all, then purging.
* add some todo's to make sure we warn in a few cases
* make `darkMode: 'media'`, the default
This also includes moving dark mode tests to its own dedicated file.
* remove PostCSS 7 compat mode
* update CLI to be JIT-first
* fix integration tests
This is not a _real_ fix, but it does solve the broken test for now.
* warn when using @responsive or @variants
* remove the JIT preview warning
* remove AOT-only code paths
* remove all `mode: 'jit'` blocks
Also remove `variants: {}` since they are not useful in `JIT` mode
anymore.
* drop unused dependencies
* rename `purge` to `content`
* remove static CDN builds
* mark `--purge` as deprecated in the CLI
This will still work, but a warning will be printed and it won't show up
in the `--help` output.
* cleanup nesting plugin
We don't have to duplicate it anymore since there is no PostCSS 7
version anymore.
* make sure integration tests run in band
* cleanup folder structure
* make sure nesting folder is available
* simplify resolving of purge/content information
2021-09-01 17:13:59 +02:00
|
|
|
content: [{ raw: `<div class="tw-animate-one"></div>` }],
|
2021-08-21 03:39:06 +01:00
|
|
|
theme: {
|
|
|
|
|
extend: {
|
|
|
|
|
keyframes: {
|
|
|
|
|
one: { to: { transform: 'rotate(360deg)' } },
|
|
|
|
|
},
|
|
|
|
|
animation: {
|
|
|
|
|
one: 'one 2s',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-03 13:48:16 +02:00
|
|
|
return run('@tailwind utilities', config).then((result) => {
|
|
|
|
|
expect(result.css).toMatchFormattedCss(css`
|
2021-08-21 03:39:06 +01:00
|
|
|
@keyframes tw-one {
|
|
|
|
|
to {
|
|
|
|
|
transform: rotate(360deg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.tw-animate-one {
|
|
|
|
|
animation: tw-one 2s;
|
|
|
|
|
}
|
|
|
|
|
`)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('multiple', () => {
|
|
|
|
|
let config = {
|
2021-09-03 13:48:16 +02:00
|
|
|
content: [{ raw: html`<div class="animate-multiple"></div>` }],
|
2021-08-21 03:39:06 +01:00
|
|
|
theme: {
|
|
|
|
|
extend: {
|
|
|
|
|
animation: {
|
|
|
|
|
multiple: 'bounce 2s linear, pulse 3s ease-in',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-03 13:48:16 +02:00
|
|
|
return run('@tailwind utilities', config).then((result) => {
|
|
|
|
|
expect(result.css).toMatchFormattedCss(css`
|
2021-08-21 03:39:06 +01:00
|
|
|
@keyframes bounce {
|
|
|
|
|
0%,
|
|
|
|
|
100% {
|
|
|
|
|
transform: translateY(-25%);
|
|
|
|
|
animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
|
|
|
|
|
}
|
|
|
|
|
50% {
|
|
|
|
|
transform: none;
|
|
|
|
|
animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@keyframes pulse {
|
|
|
|
|
50% {
|
|
|
|
|
opacity: 0.5;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.animate-multiple {
|
|
|
|
|
animation: bounce 2s linear, pulse 3s ease-in;
|
|
|
|
|
}
|
|
|
|
|
`)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('multiple custom', () => {
|
|
|
|
|
let config = {
|
2021-09-03 13:48:16 +02:00
|
|
|
content: [{ raw: html`<div class="animate-multiple"></div>` }],
|
2021-08-21 03:39:06 +01:00
|
|
|
theme: {
|
|
|
|
|
extend: {
|
|
|
|
|
keyframes: {
|
|
|
|
|
one: { to: { transform: 'rotate(360deg)' } },
|
|
|
|
|
two: { to: { transform: 'scale(1.23)' } },
|
|
|
|
|
},
|
|
|
|
|
animation: {
|
|
|
|
|
multiple: 'one 2s, two 3s',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-03 13:48:16 +02:00
|
|
|
return run('@tailwind utilities', config).then((result) => {
|
|
|
|
|
expect(result.css).toMatchFormattedCss(css`
|
2021-08-21 03:39:06 +01:00
|
|
|
@keyframes one {
|
|
|
|
|
to {
|
|
|
|
|
transform: rotate(360deg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@keyframes two {
|
|
|
|
|
to {
|
|
|
|
|
transform: scale(1.23);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.animate-multiple {
|
|
|
|
|
animation: one 2s, two 3s;
|
|
|
|
|
}
|
|
|
|
|
`)
|
2021-08-16 17:25:30 +01:00
|
|
|
})
|
|
|
|
|
})
|
2022-03-01 15:08:43 -04:00
|
|
|
|
|
|
|
|
test('with dots in the name', () => {
|
|
|
|
|
let config = {
|
|
|
|
|
content: [
|
|
|
|
|
{
|
|
|
|
|
raw: html`
|
|
|
|
|
<div class="animate-zoom-.5"></div>
|
|
|
|
|
<div class="animate-zoom-1.5"></div>
|
|
|
|
|
`,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
theme: {
|
|
|
|
|
extend: {
|
|
|
|
|
keyframes: {
|
|
|
|
|
'zoom-.5': { to: { transform: 'scale(0.5)' } },
|
|
|
|
|
'zoom-1.5': { to: { transform: 'scale(1.5)' } },
|
|
|
|
|
},
|
|
|
|
|
animation: {
|
|
|
|
|
'zoom-.5': 'zoom-.5 2s',
|
|
|
|
|
'zoom-1.5': 'zoom-1.5 2s',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return run('@tailwind utilities', config).then((result) => {
|
|
|
|
|
expect(result.css).toMatchFormattedCss(css`
|
|
|
|
|
@keyframes zoom-\.5 {
|
|
|
|
|
to {
|
|
|
|
|
transform: scale(0.5);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.animate-zoom-\.5 {
|
|
|
|
|
animation: zoom-\.5 2s;
|
|
|
|
|
}
|
|
|
|
|
@keyframes zoom-1\.5 {
|
|
|
|
|
to {
|
|
|
|
|
transform: scale(1.5);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.animate-zoom-1\.5 {
|
|
|
|
|
animation: zoom-1\.5 2s;
|
|
|
|
|
}
|
|
|
|
|
`)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('with dots in the name and prefix', () => {
|
|
|
|
|
let config = {
|
|
|
|
|
prefix: 'tw-',
|
|
|
|
|
content: [
|
|
|
|
|
{
|
|
|
|
|
raw: html`
|
|
|
|
|
<div class="tw-animate-zoom-.5"></div>
|
|
|
|
|
<div class="tw-animate-zoom-1.5"></div>
|
|
|
|
|
`,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
theme: {
|
|
|
|
|
extend: {
|
|
|
|
|
keyframes: {
|
|
|
|
|
'zoom-.5': { to: { transform: 'scale(0.5)' } },
|
|
|
|
|
'zoom-1.5': { to: { transform: 'scale(1.5)' } },
|
|
|
|
|
},
|
|
|
|
|
animation: {
|
|
|
|
|
'zoom-.5': 'zoom-.5 2s',
|
|
|
|
|
'zoom-1.5': 'zoom-1.5 2s',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return run('@tailwind utilities', config).then((result) => {
|
|
|
|
|
expect(result.css).toMatchFormattedCss(css`
|
|
|
|
|
@keyframes tw-zoom-\.5 {
|
|
|
|
|
to {
|
|
|
|
|
transform: scale(0.5);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.tw-animate-zoom-\.5 {
|
|
|
|
|
animation: tw-zoom-\.5 2s;
|
|
|
|
|
}
|
|
|
|
|
@keyframes tw-zoom-1\.5 {
|
|
|
|
|
to {
|
|
|
|
|
transform: scale(1.5);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.tw-animate-zoom-1\.5 {
|
|
|
|
|
animation: tw-zoom-1\.5 2s;
|
|
|
|
|
}
|
|
|
|
|
`)
|
|
|
|
|
})
|
|
|
|
|
})
|