Skip to content

Commit f42a442

Browse files
committed
add failing integration test
1 parent 74e084a commit f42a442

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

integrations/upgrade/index.test.ts

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2967,6 +2967,87 @@ test(
29672967
},
29682968
)
29692969

2970+
test(
2971+
'upgrade <style> blocks carefully',
2972+
{
2973+
fs: {
2974+
'package.json': json`
2975+
{
2976+
"dependencies": {
2977+
"tailwindcss": "^4",
2978+
"@tailwindcss/upgrade": "workspace:^"
2979+
}
2980+
}
2981+
`,
2982+
'src/index.vue': html`
2983+
<template
2984+
<div class="!flex"></div>
2985+
</template>
2986+
2987+
<style>
2988+
@reference "./input.css";
2989+
2990+
.foo {
2991+
@apply !bg-red-500;
2992+
}
2993+
2994+
.bar {
2995+
/* Do not upgrade the key: */
2996+
flex-shrink: 0;
2997+
}
2998+
</style>
2999+
`,
3000+
'src/input.css': css`
3001+
@import 'tailwindcss';
3002+
3003+
.foo {
3004+
flex-shrink: 1;
3005+
}
3006+
3007+
.bar {
3008+
@apply !underline;
3009+
}
3010+
`,
3011+
},
3012+
},
3013+
async ({ exec, fs, expect }) => {
3014+
await exec('npx @tailwindcss/upgrade')
3015+
3016+
expect(await fs.dumpFiles('./src/**/*.{css,vue}')).toMatchInlineSnapshot(`
3017+
"
3018+
--- ./src/index.vue ---
3019+
<template
3020+
<div class="flex!"></div>
3021+
</template>
3022+
3023+
<style>
3024+
@reference "./input.css";
3025+
3026+
.foo {
3027+
@apply !bg-red-500;
3028+
}
3029+
3030+
.bar {
3031+
/* Do not upgrade the key: */
3032+
flex-shrink: 0;
3033+
}
3034+
</style>
3035+
3036+
--- ./src/input.css ---
3037+
@import 'tailwindcss';
3038+
3039+
.foo {
3040+
flex-shrink: 1;
3041+
}
3042+
3043+
.bar {
3044+
@apply underline!;
3045+
}
3046+
"
3047+
`)
3048+
},
3049+
)
3050+
29703051
function withBOM(text: string): string {
29713052
return '\uFEFF' + text
29723053
}

0 commit comments

Comments
 (0)