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
Prev Previous commit
Next Next commit
add failing tests
  • Loading branch information
RobinMalfait committed Aug 11, 2025
commit d839a5f331e90b018dc1dc60d6b688cedaa7f8a0
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,44 @@ describe('is-safe-migration', async () => {
// Vue 3 events
[`emit('blur', props.modelValue)\n`, 'blur'],
[`$emit('blur', props.modelValue)\n`, 'blur'],

// JavaScript / TypeScript
[`document.addEventListener('blur',handleBlur)`, 'blur'],
[`document.addEventListener('blur', handleBlur)`, 'blur'],

[`function foo({ outline = true })`, 'outline'],
[`function foo({ before = false, outline = true })`, 'outline'],
[`function foo({before=false,outline=true })`, 'outline'],
[`function foo({outline=true })`, 'outline'],
// https://github.com/tailwindlabs/tailwindcss/issues/18675
[
// With default value
`function foo({ size = "1.25rem", digit, outline = true, textClass = "", className = "" })`,
'outline',
],
[
// Without default value
`function foo({ size = "1.25rem", digit, outline, textClass = "", className = "" })`,
'outline',
],
[
// As the last argument
`function foo({ size = "1.25rem", digit, outline })`,
'outline',
],
[
// As the last argument, but there is techinically another `"` on the same line
`function foo({ size = "1.25rem", digit, outline }): { return "foo" }`,
'outline',
],
[
// Tricky quote balancing
`function foo({ before = "'", outline, after = "'" }): { return "foo" }`,
'outline',
],

[`function foo(blur, foo)`, 'blur'],
[`function foo(blur,foo)`, 'blur'],
])('does not replace classes in invalid positions #%#', async (example, candidate) => {
expect(
await migrateCandidate(designSystem, {}, candidate, {
Expand Down