Skip to content

Commit fa25b21

Browse files
philipp-spiessadamwathan
authored andcommitted
Improvements
1 parent 94f6a96 commit fa25b21

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

integrations/vite/other-transforms.test.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import dedent from 'dedent'
12
import { describe, expect } from 'vitest'
23
import { css, fetchStyles, html, retryAssertion, test, ts, txt } from '../utils'
34

@@ -30,7 +31,7 @@ function createSetup(transformer: 'postcss' | 'lightningcss') {
3031
name: 'recolor',
3132
transform(code, id) {
3233
if (id.includes('.css')) {
33-
return code.replace(/red/g, 'blue')
34+
return code.replace(/red;/g, 'blue;')
3435
}
3536
},
3637
},
@@ -42,7 +43,7 @@ function createSetup(transformer: 'postcss' | 'lightningcss') {
4243
<link rel="stylesheet" href="./src/index.css" />
4344
</head>
4445
<body>
45-
<div class="foo">Hello, world!</div>
46+
<div class="foo [background-color:red]">Hello, world!</div>
4647
</body>
4748
`,
4849
'src/index.css': css`
@@ -59,7 +60,7 @@ function createSetup(transformer: 'postcss' | 'lightningcss') {
5960

6061
for (let transformer of ['postcss', 'lightningcss'] as const) {
6162
describe(transformer, () => {
62-
test(`production build`, createSetup(transformer), async ({ fs, exec }) => {
63+
test.only(`production build`, createSetup(transformer), async ({ fs, exec }) => {
6364
await exec('pnpm vite build')
6465

6566
let files = await fs.glob('dist/**/*.css')
@@ -72,6 +73,12 @@ for (let transformer of ['postcss', 'lightningcss'] as const) {
7273
color: blue;
7374
}
7475
`,
76+
// Running the transforms on utilities generated by Tailwind might change in the future
77+
dedent`
78+
.\[background-color\:red\] {
79+
background-color: blue;
80+
}
81+
`,
7582
])
7683
})
7784

@@ -86,6 +93,12 @@ for (let transformer of ['postcss', 'lightningcss'] as const) {
8693
color: blue;
8794
}
8895
`)
96+
// Running the transforms on utilities generated by Tailwind might change in the future
97+
expect(styles).toContain(dedent`
98+
.\[background-color\:red\] {
99+
background-color: blue;
100+
}
101+
`)
89102
})
90103

91104
await retryAssertion(async () => {
@@ -123,6 +136,12 @@ for (let transformer of ['postcss', 'lightningcss'] as const) {
123136
color: blue;
124137
}
125138
`)
139+
// Running the transforms on utilities generated by Tailwind might change in the future
140+
expect(styles).toContain(dedent`
141+
.\[background-color\:red\] {
142+
background-color: blue;
143+
}
144+
`)
126145
})
127146

128147
await retryAssertion(async () => {

integrations/vite/vue.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ test(
7171
expect(files).toHaveLength(1)
7272

7373
await fs.expectFileToContain(files[0][0], [candidate`underline`, candidate`foo`])
74-
75-
await fs.expectFileNotToContain(files[0][0], [':deep(.bar)'])
74+
await fs.expectFileToContain(files[0][0], ['.bar{'])
7675
},
7776
)

0 commit comments

Comments
 (0)