From 149527ddb8ed26fb01e44de7b4e39f2770f36b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Thu, 31 Jul 2025 17:08:30 +0200 Subject: [PATCH] refactor: apply requested style change --- test/playwright/TestUtils.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/playwright/TestUtils.ts b/test/playwright/TestUtils.ts index b6f45937..271b0393 100644 --- a/test/playwright/TestUtils.ts +++ b/test/playwright/TestUtils.ts @@ -412,7 +412,14 @@ class TerminalCoreProxy { } } -export async function openTerminal(ctx: ITestContext, options: ITerminalOptions | ITerminalInitOnlyOptions = {}, { useShadowDom = false, loadUnicodeGraphemesAddon = true }: { loadUnicodeGraphemesAddon?: boolean, useShadowDom?: boolean } = { }): Promise { +export async function openTerminal( + ctx: ITestContext, + options: ITerminalOptions | ITerminalInitOnlyOptions = {}, + testOptions: { useShadowDom?: boolean, loadUnicodeGraphemesAddon?: boolean } = {} +): Promise { + testOptions.useShadowDom ??= false; + testOptions.loadUnicodeGraphemesAddon ??= true; + await ctx.page.evaluate(` if ('term' in window) { try { @@ -435,7 +442,7 @@ export async function openTerminal(ctx: ITestContext, options: ITerminalOptions `; - if (useShadowDom) { + if (testOptions.useShadowDom) { script += ` const shadowRoot = element.attachShadow({ mode: "open" }); @@ -464,7 +471,7 @@ export async function openTerminal(ctx: ITestContext, options: ITerminalOptions // HACK: This is a soft layer breaker that's temporarily included until unicode graphemes have // more complete integration tests. See https://github.com/xtermjs/xterm.js/pull/4519#discussion_r1285234453 - if (loadUnicodeGraphemesAddon) { + if (testOptions.loadUnicodeGraphemesAddon) { await ctx.page.evaluate(` window.unicode = new UnicodeGraphemesAddon(); window.term.loadAddon(window.unicode);