@@ -965,6 +965,85 @@ test(
965
965
} ,
966
966
)
967
967
968
+ test (
969
+ 'migrate aria theme keys to custom variants' ,
970
+ {
971
+ fs : {
972
+ 'package.json' : json `
973
+ {
974
+ "dependencies": {
975
+ "tailwindcss": "^3",
976
+ "@tailwindcss/upgrade": "workspace:^"
977
+ }
978
+ }
979
+ ` ,
980
+ 'tailwind.config.ts' : ts `
981
+ export default {
982
+ content: {
983
+ relative: true,
984
+ files: ['./src/**/*.html'],
985
+ },
986
+ theme: {
987
+ extend: {
988
+ aria: {
989
+ // Built-in (not really, but visible because of intellisense)
990
+ busy: 'busy="true"',
991
+
992
+ // Automatically handled by bare values
993
+ foo: 'foo="true"',
994
+
995
+ // Not automatically handled by bare values because names differ
996
+ bar: 'baz="true"',
997
+
998
+ // Completely custom
999
+ asc: 'sort="ascending"',
1000
+ desc: 'sort="descending"',
1001
+ },
1002
+ },
1003
+ },
1004
+ }
1005
+ ` ,
1006
+ 'src/input.css' : css `
1007
+ @tailwind base;
1008
+ @tailwind components;
1009
+ @tailwind utilities;
1010
+ ` ,
1011
+ } ,
1012
+ } ,
1013
+ async ( { exec, fs, expect } ) => {
1014
+ await exec ( 'npx @tailwindcss/upgrade' )
1015
+
1016
+ expect ( await fs . dumpFiles ( 'src/*.css' ) ) . toMatchInlineSnapshot ( `
1017
+ "
1018
+ --- src/input.css ---
1019
+ @import 'tailwindcss';
1020
+
1021
+ @custom-variant aria-bar (&[aria-baz="true"]);
1022
+ @custom-variant aria-asc (&[aria-sort="ascending"]);
1023
+ @custom-variant aria-desc (&[aria-sort="descending"]);
1024
+
1025
+ /*
1026
+ The default border color has changed to \`currentcolor\` in Tailwind CSS v4,
1027
+ so we've added these compatibility styles to make sure everything still
1028
+ looks the same as it did with Tailwind CSS v3.
1029
+
1030
+ If we ever want to remove these styles, we need to add an explicit border
1031
+ color utility to any element that depends on these defaults.
1032
+ */
1033
+ @layer base {
1034
+ *,
1035
+ ::after,
1036
+ ::before,
1037
+ ::backdrop,
1038
+ ::file-selector-button {
1039
+ border-color: var(--color-gray-200, currentcolor);
1040
+ }
1041
+ }
1042
+ "
1043
+ ` )
1044
+ } ,
1045
+ )
1046
+
968
1047
describe ( 'border compatibility' , ( ) => {
969
1048
test (
970
1049
'migrate border compatibility' ,
0 commit comments