Skip to content

Commit 1e53283

Browse files
committed
Update tests
1 parent 6edcd5a commit 1e53283

16 files changed

+127
-34
lines changed

tests/fixtures.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ let fixtures = [
7070
},
7171
{
7272
name: 'v4: configs and plugins',
73-
dir: 'v4/configs',
73+
dir: 'v4/css-loading-js',
7474
ext: 'html',
7575
},
7676
]

tests/fixtures/v4/configs/app.css

-8
This file was deleted.

tests/fixtures/v4/configs/index.html

-3
This file was deleted.

tests/fixtures/v4/configs/my-plugin.mjs

-13
This file was deleted.

tests/fixtures/v4/configs/output.html

-3
This file was deleted.
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@import 'tailwindcss';
2+
3+
/* Load ESM versions */
4+
@config './esm/my-config.mjs';
5+
@plugin './esm/my-plugin.mjs';
6+
7+
/* Load Common JS versions */
8+
@config './cjs/my-config.cjs';
9+
@plugin './cjs/my-plugin.cjs';
10+
11+
/* Load TypeScript versions */
12+
@config './ts/my-config.ts';
13+
@plugin './ts/my-plugin.ts';
14+
15+
/* Attempt to load files that do not exist */
16+
@config './missing-confg.mjs';
17+
@plugin './missing-plugin.mjs';
18+
19+
@theme {
20+
--color-tomato: tomato;
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
theme: {
3+
extend: {
4+
colors: {
5+
'cjs-from-config': 'black',
6+
},
7+
},
8+
},
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const plugin = require('tailwindcss/plugin')
2+
3+
module.exports = plugin(
4+
({ addUtilities }) => {
5+
addUtilities({
6+
'.utility-cjs-from-plugin': {
7+
color: 'black'
8+
},
9+
'.utility-cjs-from-plugin-2': {
10+
width: '100%',
11+
height: '100%',
12+
},
13+
})
14+
},
15+
{
16+
theme: {
17+
extend: {
18+
colors: {
19+
'cjs-from-plugin': 'black',
20+
},
21+
},
22+
},
23+
},
24+
)

tests/fixtures/v4/configs/tailwind.config.mjs renamed to tests/fixtures/v4/css-loading-js/esm/my-config.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ export default {
22
theme: {
33
extend: {
44
colors: {
5-
"from-config": "#3490dc",
5+
'esm-from-config': 'black',
66
},
77
},
88
},
9-
};
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import plugin from 'tailwindcss/plugin'
2+
3+
export default plugin(
4+
({ addUtilities }) => {
5+
addUtilities({
6+
'.utility-esm-from-plugin': {
7+
color: 'black'
8+
},
9+
'.utility-esm-from-plugin-2': {
10+
width: '100%',
11+
height: '100%',
12+
},
13+
})
14+
},
15+
{
16+
theme: {
17+
extend: {
18+
colors: {
19+
'esm-from-plugin': 'black',
20+
},
21+
},
22+
},
23+
},
24+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div
2+
class="sm:bg-tomato sm:utility-cjs-from-plugin sm:utility-cjs-from-plugin-2 sm:utility-esm-from-plugin sm:utility-esm-from-plugin-2 sm:utility-ts-from-plugin sm:utility-ts-from-plugin-2 sm:bg-cjs-from-config sm:bg-cjs-from-plugin sm:bg-esm-from-config sm:bg-esm-from-plugin sm:bg-ts-from-config sm:bg-ts-from-plugin bg-red-500 utility-cjs-from-plugin utility-esm-from-plugin utility-ts-from-plugin"
3+
></div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div
2+
class="bg-red-500 utility-cjs-from-plugin utility-esm-from-plugin utility-ts-from-plugin sm:utility-cjs-from-plugin-2 sm:utility-esm-from-plugin-2 sm:utility-ts-from-plugin-2 sm:bg-cjs-from-config sm:bg-cjs-from-plugin sm:bg-esm-from-config sm:bg-esm-from-plugin sm:bg-tomato sm:bg-ts-from-config sm:bg-ts-from-plugin sm:utility-cjs-from-plugin sm:utility-esm-from-plugin sm:utility-ts-from-plugin"
3+
></div>

tests/fixtures/v4/configs/package-lock.json renamed to tests/fixtures/v4/css-loading-js/package-lock.json

+5-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { Config } from 'tailwindcss'
2+
3+
export default {
4+
theme: {
5+
extend: {
6+
colors: {
7+
'ts-from-config': 'black',
8+
},
9+
},
10+
},
11+
} satisfies Config
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import plugin from 'tailwindcss/plugin'
2+
3+
export default plugin(
4+
({ addUtilities }) => {
5+
addUtilities({
6+
'.utility-ts-from-plugin': {
7+
color: 'black'
8+
},
9+
'.utility-ts-from-plugin-2': {
10+
width: '100%',
11+
height: '100%',
12+
},
13+
})
14+
},
15+
{
16+
theme: {
17+
extend: {
18+
colors: {
19+
'ts-from-plugin': 'black',
20+
},
21+
},
22+
},
23+
},
24+
)

0 commit comments

Comments
 (0)