-
Notifications
You must be signed in to change notification settings - Fork 923
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): add case for importing styles from packages
- Loading branch information
Showing
9 changed files
with
62 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
import { defineClientConfig } from 'vuepress/client' | ||
import RootComponentFromUserConfig from './components/RootComponentFromUserConfig.vue' | ||
|
||
// static imported styles file | ||
import '@vuepress-e2e/style-exports/foo.css' | ||
|
||
export default defineClientConfig({ | ||
async enhance() { | ||
// dynamic imported styles file | ||
await import('@vuepress-e2e/style-exports') | ||
}, | ||
rootComponents: [RootComponentFromUserConfig], | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="style-exports">dynamic import</div> | ||
|
||
<div class="style-exports-foo">static import</div> |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.style-exports-foo { | ||
font-size: 30px; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.style-exports { | ||
font-size: 20px; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "@vuepress-e2e/style-exports", | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"types": "./types.d.ts", | ||
"default": "./index.css" | ||
}, | ||
"./foo.css": { | ||
"types": "./types.d.ts", | ||
"default": "./foo.css" | ||
} | ||
}, | ||
"main": "./index.css", | ||
"module": "./index.css", | ||
"types": "./types.d.ts" | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export {} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
test('should load dynamic imported styles correctly', async ({ page }) => { | ||
await page.goto('imports/style-exports.html') | ||
|
||
const locator = page.locator('.style-exports') | ||
|
||
await expect(locator).toHaveText('dynamic import') | ||
Check failure on line 8 in e2e/tests/imports/style-exports.spec.ts GitHub Actions / e2e (macos-latest, 20, vite)[chromium] › imports/style-exports.spec.ts:3:1 › should load dynamic imported styles correctly
|
||
await expect(locator).toHaveCSS('font-size', '20px') | ||
}) | ||
|
||
test('should load static imported styles correctly', async ({ page }) => { | ||
await page.goto('imports/style-exports.html') | ||
|
||
const locator = page.locator('.style-exports-foo') | ||
|
||
await expect(locator).toHaveText('static import') | ||
await expect(locator).toHaveCSS('font-size', '30px') | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.