tailwindcss/tests/syntax-svelte.test.js
Robin Malfait 44b3b429a8
Cleanup oxide — Part #2 (#13312)
* remove all oxide related code

* Update lightningcss to version 1.24.1

* update tests to match bumped Lightning CSS output

---------

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2024-03-22 17:12:14 +01:00

78 lines
1.7 KiB
JavaScript

import path from 'path'
import { run, css } from './util/run'
test('it detects svelte based on the file extension', () => {
let config = {
content: [path.resolve(__dirname, './syntax-svelte.test.svelte')],
corePlugins: { preflight: false },
theme: {},
plugins: [],
}
let input = css`
@tailwind components;
@tailwind utilities;
`
return run(input, config).then((result) => {
expect(result.css).toMatchCss(css`
.bg-red-500 {
--tw-bg-opacity: 1;
background-color: rgb(239 68 68 / var(--tw-bg-opacity));
}
@media (min-width: 1024px) {
.lg\:hover\:bg-blue-500:hover {
--tw-bg-opacity: 1;
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
}
}
`)
})
})
test('using raw with svelte extension', () => {
let config = {
content: [
{
raw: `
<script>
let current = 'foo'
</script>
<button class:lg:hover:bg-blue-500={current === 'foo'}>Click me</button>
<button
class:bg-red-500={current === 'foo'}
>
Click me
</button>
`,
extension: 'svelte',
},
],
corePlugins: { preflight: false },
theme: {},
plugins: [],
}
let input = css`
@tailwind components;
@tailwind utilities;
`
return run(input, config).then((result) => {
expect(result.css).toMatchCss(css`
.bg-red-500 {
--tw-bg-opacity: 1;
background-color: rgb(239 68 68 / var(--tw-bg-opacity));
}
@media (min-width: 1024px) {
.lg\:hover\:bg-blue-500:hover {
--tw-bg-opacity: 1;
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
}
}
`)
})
})