Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
2 changes: 1 addition & 1 deletion core/scripts/testing/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* The following URL parameters are supported:
* - `rtl`: Set to `true` to enable right-to-left directionality.
* - `ionic:_testing`: Set to `true` to identify testing environments.
* - `ionic:mode`: Set to `ios` or `md` to load a specific mode.
* - `ionic:theme`: Set to `ios` or `md` to load a specific theme.
* Defaults to `md`.
* - `palette`: Set to `light`, `dark`, `high-contrast`, or
* `high-contrast-dark` to load a specific palette. Defaults to `light`.
Expand Down
15 changes: 7 additions & 8 deletions core/src/utils/test/playwright/page/utils/set-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ export const setContent = async (page: Page, html: string, testInfo: TestInfo, o

let mode: Mode;
let direction: Direction;
let theme: Theme;
let themeName: Theme;
let palette: Palette;

if (options == undefined) {
mode = testInfo.project.metadata.mode;
direction = testInfo.project.metadata.rtl ? 'rtl' : 'ltr';
theme = testInfo.project.metadata.theme;
themeName = testInfo.project.metadata.theme;
palette = testInfo.project.metadata.palette;
} else {
mode = options.mode;
direction = options.direction;
theme = options.theme;
themeName = options.theme;
palette = options.palette;
}

Expand All @@ -40,7 +40,7 @@ export const setContent = async (page: Page, html: string, testInfo: TestInfo, o
// config passes in the importIonicFromCDN option. This is useful
// when testing with the CDN version of Ionic.
let ionicCSSImports =
theme === 'ionic'
themeName === 'ionic'
? `
<link href="${baseUrl}/css/ionic/bundle.ionic.css" rel="stylesheet" />
<link href="${baseUrl}/css/utils.bundle.css" rel="stylesheet" />
Expand All @@ -54,7 +54,7 @@ export const setContent = async (page: Page, html: string, testInfo: TestInfo, o

if (options?.importIonicFromCDN) {
ionicCSSImports =
theme === 'ionic'
themeName === 'ionic'
? `
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core/css/ionic/bundle.ionic.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core/css/utils.bundle.css" />
Expand All @@ -77,14 +77,13 @@ export const setContent = async (page: Page, html: string, testInfo: TestInfo, o
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
${ionicCSSImports}
<link href="${baseUrl}/scripts/testing/styles.css" rel="stylesheet" />
${palette !== 'light' ? `<link href="${baseUrl}/css/palettes/${palette}.always.css" rel="stylesheet" />` : ''}
<script src="${baseUrl}/scripts/testing/scripts.js"></script>
${ionicJSImports}
<script>
window.Ionic = {
config: {
mode: '${mode}',
theme: '${theme}'
theme: '${themeName}',
}
}
</script>
Expand All @@ -107,7 +106,7 @@ export const setContent = async (page: Page, html: string, testInfo: TestInfo, o

testInfo.annotations.push({
type: 'theme',
description: theme,
description: themeName,
});

if (baseUrl) {
Expand Down
Loading