2019-12-06 16:28:16 +01:00
|
|
|
/**
|
|
|
|
|
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
|
|
|
|
|
* @license MIT
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { assert } from 'chai';
|
2021-08-31 12:50:54 +02:00
|
|
|
import { openTerminal, launchBrowser } from '../../../out-test/api/TestUtils';
|
2023-08-27 08:08:42 -07:00
|
|
|
import { Browser, Page } from '@playwright/test';
|
2019-12-06 16:28:16 +01:00
|
|
|
|
2021-04-06 15:48:48 +01:00
|
|
|
const APP = 'http://127.0.0.1:3001/test';
|
2019-12-06 16:28:16 +01:00
|
|
|
|
2020-02-13 00:07:07 -06:00
|
|
|
let browser: Browser;
|
|
|
|
|
let page: Page;
|
2019-12-06 16:28:16 +01:00
|
|
|
const width = 800;
|
|
|
|
|
const height = 600;
|
|
|
|
|
|
|
|
|
|
describe('Unicode11Addon', () => {
|
2020-02-12 16:00:21 -06:00
|
|
|
before(async function(): Promise<any> {
|
2021-08-31 12:50:54 +02:00
|
|
|
browser = await launchBrowser();
|
2020-02-15 05:18:46 -08:00
|
|
|
page = await (await browser.newContext()).newPage();
|
|
|
|
|
await page.setViewportSize({ width, height });
|
2019-12-06 16:28:16 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
after(async () => {
|
|
|
|
|
await browser.close();
|
|
|
|
|
});
|
|
|
|
|
|
2020-02-12 16:00:21 -06:00
|
|
|
beforeEach(async function(): Promise<any> {
|
2019-12-06 16:28:16 +01:00
|
|
|
await page.goto(APP);
|
2020-02-11 11:39:36 -06:00
|
|
|
await openTerminal(page);
|
2019-12-06 16:28:16 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('wcwidth V11 emoji test', async () => {
|
|
|
|
|
await page.evaluate(`
|
|
|
|
|
window.unicode11 = new Unicode11Addon();
|
|
|
|
|
window.term.loadAddon(window.unicode11);
|
|
|
|
|
`);
|
|
|
|
|
// should have loaded '11'
|
2023-05-20 15:05:32 +02:00
|
|
|
assert.deepEqual((await page.evaluate(`window.term.unicode.versions`) as string[]).includes('11'), true);
|
2019-12-06 16:28:16 +01:00
|
|
|
// switch should not throw
|
|
|
|
|
await page.evaluate(`window.term.unicode.activeVersion = '11';`);
|
|
|
|
|
assert.deepEqual(await page.evaluate(`window.term.unicode.activeVersion`), '11');
|
|
|
|
|
// v6: 10, V11: 20
|
2020-01-04 15:39:00 +01:00
|
|
|
assert.deepEqual(await page.evaluate(`window.term._core.unicodeService.getStringCellWidth('🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣')`), 20);
|
2019-12-06 16:28:16 +01:00
|
|
|
});
|
|
|
|
|
});
|