refactor(dark): update to the latest v8 changes

This commit is contained in:
Maria Hutt 2024-04-17 16:29:55 -07:00
parent c4aa090135
commit b741493dd3
2 changed files with 6 additions and 18 deletions

View File

@ -24,13 +24,7 @@
const linkTag = document.createElement('link');
linkTag.setAttribute('rel', 'stylesheet');
linkTag.setAttribute('type', 'text/css');
/**
* The file must be the same as the one being used in Playwright tests
* when `dark` is being passed as a `theme` option.
* This provides consistency when Playwright is running through
* the test page or the `setContent` method.
*/
linkTag.setAttribute('href', `/scripts/testing/themes/${palette[1]}.css`);
linkTag.setAttribute('href', `/css/palettes/${palette[1]}.always.css`);
document.head.appendChild(linkTag);
}

View File

@ -1,5 +1,5 @@
import type { Page, TestInfo } from '@playwright/test';
import type { E2EPageOptions, Mode, Direction, Theme } from '@utils/test/playwright';
import type { E2EPageOptions, Mode, Direction, Palette } from '@utils/test/playwright';
/**
* This is an extended version of Playwright's
@ -28,16 +28,16 @@ configs().forEach(({ config, title }) => {
let mode: Mode;
let direction: Direction;
let theme: Theme;
let palette: Palette;
if (options == undefined) {
mode = testInfo.project.metadata.mode;
direction = testInfo.project.metadata.rtl ? 'rtl' : 'ltr';
theme = testInfo.project.metadata.theme;
palette = testInfo.project.metadata.palette;
} else {
mode = options.mode;
direction = options.direction;
theme = options.theme;
palette = options.palette;
}
const rtlString = direction === 'rtl' ? 'true' : undefined;
@ -52,13 +52,7 @@ configs().forEach(({ config, title }) => {
const urlToParams = new URLSearchParams(paramsString);
const formattedMode = urlToParams.get('ionic:mode') ?? mode;
const formattedRtl = urlToParams.get('rtl') ?? rtlString;
/**
* The term `palette` is used to as a param to
* match the Ionic docs, plus here is already a
* `ionic:theme` query being used for `md`, `ios`,
* and `ionic` themes.
*/
const formattedPalette = urlToParams.get('palette') ?? theme;
const formattedPalette = urlToParams.get('palette') ?? palette;
const ionicTesting = urlToParams.get('ionic:_testing') ?? true;
/**