mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
add api tests
This commit is contained in:
+1
-1
@@ -174,7 +174,7 @@
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.xterm-screen canvas .xterm-decoration {
|
||||
#terminal-container > div > div.xterm-screen > div.xterm-decoration {
|
||||
z-index: 6;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
+1
-2
@@ -531,5 +531,4 @@ function decoration() {
|
||||
const marker = term.addMarker(1);
|
||||
const decoration = term.registerDecoration({ marker });
|
||||
decoration.element.style.backgroundColor = 'red';
|
||||
decoration.element.style.position = 'absolute';
|
||||
}
|
||||
}
|
||||
@@ -731,6 +731,28 @@ describe('API Integration Tests', function(): void {
|
||||
await pollFor(page, `window.term._core._renderService.dimensions.actualCellWidth > 0`, true);
|
||||
});
|
||||
|
||||
describe.only('registerDecoration', () => {
|
||||
it('should register a decoration', async () => {
|
||||
await openTerminal(page);
|
||||
await page.evaluate(`window.marker = window.term.addMarker(1)`);
|
||||
await page.evaluate(`window.decoration = window.term.registerDecoration({ marker: window.marker });`);
|
||||
assert.notEqual(await page.evaluate(`document.querySelector('.xterm-screen .xterm-decoration')`), undefined);
|
||||
});
|
||||
it('should return undefined when the marker has already been disposed of', async () => {
|
||||
await openTerminal(page);
|
||||
await page.evaluate(`window.marker = window.term.addMarker(1)`);
|
||||
await page.evaluate(`window.marker.dispose()`);
|
||||
assert.equal(await page.evaluate(`window.decoration = window.term.registerDecoration({ marker: window.marker });`), undefined);
|
||||
assert.equal(await page.evaluate(`document.querySelector('.xterm-screen .xterm-decoration')`), undefined);
|
||||
});
|
||||
it.skip('should throw when a negative x offset is provided', async () => {
|
||||
await openTerminal(page);
|
||||
await page.evaluate(`window.marker = window.term.addMarker(1)`);
|
||||
assert.throws(async () => await page.evaluate(`window.decoration = window.term.registerDecoration({ marker: window.marker, x: -2 });`));
|
||||
assert.equal(await page.evaluate(`document.querySelector('.xterm-screen .xterm-decoration')`), undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('registerLinkProvider', () => {
|
||||
it('should fire provideLinks when hovering cells', async () => {
|
||||
await openTerminal(page, { rendererType: 'dom' });
|
||||
|
||||
Reference in New Issue
Block a user