Skip to content

Commit 149527d

Browse files
author
Loïc Mangeonjean
committed
refactor: apply requested style change
1 parent 3ad83dd commit 149527d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/playwright/TestUtils.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,14 @@ class TerminalCoreProxy {
412412
}
413413
}
414414

415-
export async function openTerminal(ctx: ITestContext, options: ITerminalOptions | ITerminalInitOnlyOptions = {}, { useShadowDom = false, loadUnicodeGraphemesAddon = true }: { loadUnicodeGraphemesAddon?: boolean, useShadowDom?: boolean } = { }): Promise<void> {
415+
export async function openTerminal(
416+
ctx: ITestContext,
417+
options: ITerminalOptions | ITerminalInitOnlyOptions = {},
418+
testOptions: { useShadowDom?: boolean, loadUnicodeGraphemesAddon?: boolean } = {}
419+
): Promise<void> {
420+
testOptions.useShadowDom ??= false;
421+
testOptions.loadUnicodeGraphemesAddon ??= true;
422+
416423
await ctx.page.evaluate(`
417424
if ('term' in window) {
418425
try {
@@ -435,7 +442,7 @@ export async function openTerminal(ctx: ITestContext, options: ITerminalOptions
435442
`;
436443

437444

438-
if (useShadowDom) {
445+
if (testOptions.useShadowDom) {
439446
script += `
440447
const shadowRoot = element.attachShadow({ mode: "open" });
441448
@@ -464,7 +471,7 @@ export async function openTerminal(ctx: ITestContext, options: ITerminalOptions
464471

465472
// HACK: This is a soft layer breaker that's temporarily included until unicode graphemes have
466473
// more complete integration tests. See https://github.com/xtermjs/xterm.js/pull/4519#discussion_r1285234453
467-
if (loadUnicodeGraphemesAddon) {
474+
if (testOptions.loadUnicodeGraphemesAddon) {
468475
await ctx.page.evaluate(`
469476
window.unicode = new UnicodeGraphemesAddon();
470477
window.term.loadAddon(window.unicode);

0 commit comments

Comments
 (0)