mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Add testOptions parameter to openTerminal in TestUtils.
This is used to control whether the UnicodeGraphemesAddon is loaded.
This commit is contained in:
@@ -34,7 +34,7 @@ describe('API Integration Tests', function(): void {
|
||||
|
||||
// fails with the grapheme injection, not sure why...
|
||||
it('Proposed API check', async () => {
|
||||
await openTerminal(page, { allowProposedApi: false });
|
||||
await openTerminal(page, { allowProposedApi: false }, { loadUnicodeGraphemesAddon: false });
|
||||
await page.evaluate(`
|
||||
try {
|
||||
window.term.markers;
|
||||
|
||||
@@ -43,18 +43,18 @@ 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 = {}): Promise<void> {
|
||||
export async function openTerminal(page: playwright.Page, options: ITerminalOptions & ITerminalInitOnlyOptions = {}, testOptions: any = { 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'))`);
|
||||
|
||||
/*
|
||||
// TODO: make this injection configurable from outside
|
||||
await page.evaluate(`
|
||||
window.unicode = new UnicodeGraphemesAddon();
|
||||
window.term.loadAddon(window.unicode);
|
||||
window.term.unicode.activeVersion = '15-graphemes';
|
||||
`);
|
||||
*/
|
||||
// See https://github.com/xtermjs/xterm.js/pull/4519#discussion_r1285234453
|
||||
if (testOptions.loadUnicodeGraphemesAddon) {
|
||||
await page.evaluate(`
|
||||
window.unicode = new UnicodeGraphemesAddon();
|
||||
window.term.loadAddon(window.unicode);
|
||||
window.term.unicode.activeVersion = '15-graphemes';
|
||||
`);
|
||||
}
|
||||
await page.waitForSelector('.xterm-rows');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user