-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
964fc04
commit 670eff4
Showing
18 changed files
with
210 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,45 @@ | ||
import { build, dev, gotoPage } from '@e2e/helper'; | ||
import { expect, test } from '@playwright/test'; | ||
|
||
test('should exports global in CSS Modules correctly in dev build', async ({ | ||
page, | ||
}) => { | ||
const rsbuild = await dev({ | ||
cwd: __dirname, | ||
}); | ||
|
||
await gotoPage(page, rsbuild); | ||
|
||
const test1Locator = page.locator('#test1'); | ||
await expect(test1Locator).toHaveCSS('color', 'rgb(255, 0, 0)'); | ||
|
||
const test2Locator = page.locator('#test2'); | ||
await expect(test2Locator).toHaveCSS('color', 'rgb(0, 0, 255)'); | ||
|
||
await rsbuild.close(); | ||
}); | ||
|
||
test('should exports global in CSS Modules correctly in prod build', async ({ | ||
page, | ||
}) => { | ||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
runServer: true, | ||
}); | ||
await gotoPage(page, rsbuild); | ||
|
||
const test1Locator = page.locator('#test1'); | ||
await expect(test1Locator).toHaveCSS('color', 'rgb(255, 0, 0)'); | ||
|
||
const test2Locator = page.locator('#test2'); | ||
await expect(test2Locator).toHaveCSS('color', 'rgb(0, 0, 255)'); | ||
|
||
await rsbuild.close(); | ||
|
||
const files = await rsbuild.unwrapOutputJSON(); | ||
const content = | ||
files[Object.keys(files).find((file) => file.endsWith('.css'))!]; | ||
expect(content).toMatch(/\.foo-\w{6}{color:red}\.bar{color:blue}/); | ||
}); | ||
import { build, dev, gotoPage, rspackOnlyTest } from '@e2e/helper'; | ||
import { expect } from '@playwright/test'; | ||
|
||
rspackOnlyTest( | ||
'should exports global in CSS Modules correctly in dev build', | ||
async ({ page }) => { | ||
const rsbuild = await dev({ | ||
cwd: __dirname, | ||
}); | ||
|
||
await gotoPage(page, rsbuild); | ||
|
||
const test1Locator = page.locator('#test1'); | ||
await expect(test1Locator).toHaveCSS('color', 'rgb(255, 0, 0)'); | ||
|
||
const test2Locator = page.locator('#test2'); | ||
await expect(test2Locator).toHaveCSS('color', 'rgb(0, 0, 255)'); | ||
|
||
await rsbuild.close(); | ||
}, | ||
); | ||
|
||
rspackOnlyTest( | ||
'should exports global in CSS Modules correctly in prod build', | ||
async ({ page }) => { | ||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
runServer: true, | ||
}); | ||
await gotoPage(page, rsbuild); | ||
|
||
const test1Locator = page.locator('#test1'); | ||
await expect(test1Locator).toHaveCSS('color', 'rgb(255, 0, 0)'); | ||
|
||
const test2Locator = page.locator('#test2'); | ||
await expect(test2Locator).toHaveCSS('color', 'rgb(0, 0, 255)'); | ||
|
||
await rsbuild.close(); | ||
|
||
const files = await rsbuild.unwrapOutputJSON(); | ||
const content = | ||
files[Object.keys(files).find((file) => file.endsWith('.css'))!]; | ||
expect(content).toMatch(/\.foo-\w{6}{color:red}\.bar{color:#00f}/); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
import { build } from '@e2e/helper'; | ||
import { expect, test } from '@playwright/test'; | ||
import { build, rspackOnlyTest } from '@e2e/helper'; | ||
import { expect } from '@playwright/test'; | ||
|
||
test('should compile CSS Modules which depends on importLoaders correctly', async () => { | ||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
}); | ||
const files = await rsbuild.unwrapOutputJSON(); | ||
rspackOnlyTest( | ||
'should compile CSS Modules which depends on importLoaders correctly', | ||
async () => { | ||
const rsbuild = await build({ | ||
cwd: __dirname, | ||
}); | ||
const files = await rsbuild.unwrapOutputJSON(); | ||
|
||
const content = | ||
files[Object.keys(files).find((file) => file.endsWith('.css'))!]; | ||
const content = | ||
files[Object.keys(files).find((file) => file.endsWith('.css'))!]; | ||
|
||
expect(content).toEqual( | ||
'.class-foo-yQ8Tl7+.hello-class-foo{background-color:red}.class-bar-TVH2T6 .hello-class-bar{background-color:blue}', | ||
); | ||
}); | ||
expect(content).toEqual( | ||
'.class-foo-yQ8Tl7+.hello-class-foo{background-color:red}.class-bar-TVH2T6 .hello-class-bar{background-color:#00f}', | ||
); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
@a: `function(width) { | ||
return (width + 100); | ||
@a: `function(val) { | ||
return (val + 0.1); | ||
}`; | ||
|
||
body { | ||
width: `(@{a})(100)`; | ||
opacity: `(@{a})(0.1)`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.