@@ -2893,6 +2893,68 @@ test(
2893
2893
} ,
2894
2894
)
2895
2895
2896
+ test (
2897
+ 'upgrades run on v4 projects' ,
2898
+ {
2899
+ fs : {
2900
+ 'package.json' : json `
2901
+ {
2902
+ "dependencies": {
2903
+ "tailwindcss": "^4",
2904
+ "@tailwindcss/upgrade": "workspace:^"
2905
+ },
2906
+ "devDependencies": {
2907
+ "@tailwindcss/cli": "workspace:^"
2908
+ }
2909
+ }
2910
+ ` ,
2911
+ 'src/index.html' : html `
2912
+ <!-- Migrating ' ring', 'rounded' and 'outline-none' are unsafe in v4 - > v4 migrations -- >
2913
+ <div class= "ring rounded outline" > </ div>
2914
+
2915
+ <!- - Variant or der is also unsafe to change in v4 projects - - >
2916
+ <div class= "file:hover:flex *:hover:flex" > </ div>
2917
+ <div class= "hover:file:flex hover:*:flex" > </ div>
2918
+
2919
+ <!- - These are safe to migrate: - - >
2920
+ <div class= "!flex bg-red-500/[var(--my-opacity)] [@media(pointer:fine)]:flex" > </ div>
2921
+ ` ,
2922
+ 'src/input.css' : css `
2923
+ @import 'tailwindcss' ;
2924
+
2925
+ .foo {
2926
+ @apply !bg- [var (- - my- color )];
2927
+ }
2928
+ ` ,
2929
+ } ,
2930
+ } ,
2931
+ async ( { exec, fs, expect } ) => {
2932
+ await exec ( 'npx @tailwindcss/upgrade' )
2933
+
2934
+ expect ( await fs . dumpFiles ( './src/**/*.{css,html}' ) ) . toMatchInlineSnapshot ( `
2935
+ "
2936
+ --- ./src/index.html ---
2937
+ <!-- Migrating 'ring', 'rounded' and 'outline-none' are unsafe in v4 -> v4 migrations -->
2938
+ <div class="ring rounded outline"></div>
2939
+
2940
+ <!-- Variant order is also unsafe to change in v4 projects -->
2941
+ <div class="file:hover:flex *:hover:flex"></div>
2942
+ <div class="hover:file:flex hover:*:flex"></div>
2943
+
2944
+ <!-- These are safe to migrate: -->
2945
+ <div class="flex! bg-red-500/(--my-opacity) pointer-fine:flex"></div>
2946
+
2947
+ --- ./src/input.css ---
2948
+ @import 'tailwindcss';
2949
+
2950
+ .foo {
2951
+ @apply bg-(--my-color)!;
2952
+ }
2953
+ "
2954
+ ` )
2955
+ } ,
2956
+ )
2957
+
2896
2958
function withBOM ( text : string ) : string {
2897
2959
return '\uFEFF' + text
2898
2960
}
0 commit comments