Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add failing test
  • Loading branch information
RobinMalfait committed Aug 28, 2025
commit 8c7b8541c4d91a43a1761adddaa3eb1f809106cc
89 changes: 89 additions & 0 deletions integrations/upgrade/js-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,95 @@ test(
},
)

test(
'migrate supports theme keys to custom variants',
{
fs: {
'package.json': json`
{
"dependencies": {
"tailwindcss": "^3",
"@tailwindcss/upgrade": "workspace:^"
}
}
`,
'tailwind.config.ts': ts`
export default {
content: {
relative: true,
files: ['./src/**/*.html'],
},
theme: {
extend: {
supports: {
// Automatically handled by bare values (using CSS variable as the value)
foo: 'foo: var(--foo)', // parentheses are optional
bar: '(bar: var(--bar))',

// Not automatically handled by bare values because names differ
foo: 'bar: var(--foo)', // parentheses are optional
bar: '(qux: var(--bar))',

// Custom
grid: 'display: grid',
},
},
},
}
`,
'src/input.css': css`
@tailwind base;
@tailwind components;
@tailwind utilities;
`,
},
},
async ({ exec, fs, expect }) => {
await exec('npx @tailwindcss/upgrade')

expect(await fs.dumpFiles('src/*.css')).toMatchInlineSnapshot(`
"
--- src/input.css ---
@import 'tailwindcss';

@custom-variant supports-foo {
@supports (bar: var(--foo)) {
@slot;
}
}
@custom-variant supports-bar {
@supports ((qux: var(--bar))) {
@slot;
}
}
@custom-variant supports-grid {
@supports (display: grid) {
@slot;
}
}

/*
The default border color has changed to \`currentcolor\` in Tailwind CSS v4,
so we've added these compatibility styles to make sure everything still
looks the same as it did with Tailwind CSS v3.

If we ever want to remove these styles, we need to add an explicit border
color utility to any element that depends on these defaults.
*/
@layer base {
*,
::after,
::before,
::backdrop,
::file-selector-button {
border-color: var(--color-gray-200, currentcolor);
}
}
"
`)
},
)

describe('border compatibility', () => {
test(
'migrate border compatibility',
Expand Down