Skip to content

Commit

Permalink
Final polish
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Sep 12, 2023
1 parent 8183d1d commit 32c6165
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions test/api/TestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ export async function timeout(ms: number): Promise<void> {
return new Promise<void>(r => setTimeout(r, ms));
}

export async function openTerminal(page: playwright.Page, options: ITerminalOptions & ITerminalInitOnlyOptions = {}, testOptions: any = { loadUnicodeGraphemesAddon: true}): Promise<void> {
export async function openTerminal(page: playwright.Page, options: ITerminalOptions & ITerminalInitOnlyOptions = {}, testOptions: { loadUnicodeGraphemesAddon: boolean } = { loadUnicodeGraphemesAddon: true }): Promise<void> {
await page.evaluate(`window.term = new Terminal(${JSON.stringify({ allowProposedApi: true, ...options })})`);
await page.evaluate(`window.term.open(document.querySelector('#terminal-container'))`);

// See https://github.com/xtermjs/xterm.js/pull/4519#discussion_r1285234453

// 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 (testOptions.loadUnicodeGraphemesAddon) {
await page.evaluate(`
window.unicode = new UnicodeGraphemesAddon();
Expand Down
5 changes: 3 additions & 2 deletions test/playwright/TestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ class TerminalCoreProxy {
}
}

export async function openTerminal(ctx: ITestContext, options: ITerminalOptions | ITerminalInitOnlyOptions = {}, testOptions: any = { loadUnicodeGraphemesAddon: true}): Promise<void> {
export async function openTerminal(ctx: ITestContext, options: ITerminalOptions | ITerminalInitOnlyOptions = {}, testOptions: { loadUnicodeGraphemesAddon: boolean } = { loadUnicodeGraphemesAddon: true }): Promise<void> {
await ctx.page.evaluate(`
if ('term' in window) {
try {
Expand All @@ -366,7 +366,8 @@ export async function openTerminal(ctx: ITestContext, options: ITerminalOptions
window.term = new window.Terminal(${JSON.stringify({ allowProposedApi: true, ...options })});
window.term.open(document.querySelector('#terminal-container'));
`);
// See https://github.com/xtermjs/xterm.js/pull/4519#discussion_r1285234453
// 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 (testOptions.loadUnicodeGraphemesAddon) {
await ctx.page.evaluate(`
window.unicode = new UnicodeGraphemesAddon();
Expand Down

0 comments on commit 32c6165

Please sign in to comment.