|
1 | 1 | import { __unstable__loadDesignSystem } from '@tailwindcss/node'
|
2 | 2 | import { expect, test, vi } from 'vitest'
|
3 | 3 | import * as versions from '../../utils/version'
|
4 |
| -import { isSafeMigration } from './is-safe-migration' |
5 | 4 | import { migrateLegacyClasses } from './migrate-legacy-classes'
|
6 | 5 | vi.spyOn(versions, 'isMajor').mockReturnValue(true)
|
7 | 6 |
|
@@ -44,43 +43,3 @@ test.each([
|
44 | 43 |
|
45 | 44 | expect(await migrateLegacyClasses(designSystem, {}, candidate)).toEqual(result)
|
46 | 45 | })
|
47 |
| - |
48 |
| -test('does not replace classes in invalid positions', async () => { |
49 |
| - let designSystem = await __unstable__loadDesignSystem('@import "tailwindcss";', { |
50 |
| - base: __dirname, |
51 |
| - }) |
52 |
| - |
53 |
| - async function shouldNotReplace(example: string, candidate = 'shadow') { |
54 |
| - let location = { |
55 |
| - contents: example, |
56 |
| - start: example.indexOf(candidate), |
57 |
| - end: example.indexOf(candidate) + candidate.length, |
58 |
| - } |
59 |
| - |
60 |
| - // Skip this migration if we think that the migration is unsafe |
61 |
| - if (location && !isSafeMigration(candidate, location, designSystem)) { |
62 |
| - return candidate |
63 |
| - } |
64 |
| - |
65 |
| - expect(await migrateLegacyClasses(designSystem, {}, candidate)).toEqual(candidate) |
66 |
| - } |
67 |
| - |
68 |
| - await shouldNotReplace(`let notShadow = shadow \n`) |
69 |
| - await shouldNotReplace(`{ "foo": shadow.something + ""}\n`) |
70 |
| - await shouldNotReplace(`<div v-if="something && shadow"></div>\n`) |
71 |
| - await shouldNotReplace(`<div v-else-if="something && shadow"></div>\n`) |
72 |
| - await shouldNotReplace(`<div v-show="something && shadow"></div>\n`) |
73 |
| - await shouldNotReplace(`<div v-if="shadow || shadow"></div>\n`) |
74 |
| - await shouldNotReplace(`<div v-else-if="shadow || shadow"></div>\n`) |
75 |
| - await shouldNotReplace(`<div v-show="shadow || shadow"></div>\n`) |
76 |
| - await shouldNotReplace(`<div v-if="shadow"></div>\n`) |
77 |
| - await shouldNotReplace(`<div v-else-if="shadow"></div>\n`) |
78 |
| - await shouldNotReplace(`<div v-show="shadow"></div>\n`) |
79 |
| - await shouldNotReplace(`<div x-if="shadow"></div>\n`) |
80 |
| - await shouldNotReplace(`<div style={{filter: 'drop-shadow(30px 10px 4px #4444dd)'}}/>\n`) |
81 |
| - |
82 |
| - // Next.js Image placeholder cases |
83 |
| - await shouldNotReplace(`<Image placeholder="blur" src="/image.jpg" />`, 'blur') |
84 |
| - await shouldNotReplace(`<Image placeholder={'blur'} src="/image.jpg" />`, 'blur') |
85 |
| - await shouldNotReplace(`<Image placeholder={blur} src="/image.jpg" />`, 'blur') |
86 |
| -}) |
0 commit comments