Skip to content

Commit e040003

Browse files
committed
Add more tests for LineDataEventAddon
1 parent a3bac06 commit e040003

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/vs/workbench/contrib/terminal/test/browser/addons/lineDataEventAddon.ts renamed to src/vs/workbench/contrib/terminal/test/browser/addons/lineDataEventAddon.test.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55

66
import { Terminal } from 'xterm';
77
import { LineDataEventAddon } from 'vs/workbench/contrib/terminal/browser/addons/lineDataEventAddon';
8+
import { OperatingSystem } from 'vs/base/common/platform';
89
import { deepStrictEqual } from 'assert';
910

1011
async function writeP(terminal: Terminal, data: string): Promise<void> {
1112
return new Promise<void>(r => terminal.write(data, r));
1213
}
1314

14-
suite.only('XtermExtensions', () => {
15+
suite('LineDataEventAddon', () => {
1516
let xterm: Terminal;
1617
let lineDataEventAddon: LineDataEventAddon;
1718

@@ -29,7 +30,7 @@ suite.only('XtermExtensions', () => {
2930
lineDataEventAddon.onLineData(e => events.push(e));
3031
});
3132

32-
test('should fire when a non-wrapped line ends with a \\n', async () => {
33+
test('should fire when a non-wrapped line ends with a line feed', async () => {
3334
await writeP(xterm, 'foo');
3435
deepStrictEqual(events, []);
3536
await writeP(xterm, '\n\r');
@@ -49,11 +50,22 @@ suite.only('XtermExtensions', () => {
4950
deepStrictEqual(events, []);
5051
});
5152

52-
test('should fire when a wrapped line ends with a \\n', async () => {
53+
test('should fire when a wrapped line ends with a line feed', async () => {
5354
await writeP(xterm, 'foo.bar.baz.');
5455
deepStrictEqual(events, []);
5556
await writeP(xterm, '\n\r');
5657
deepStrictEqual(events, ['foo.bar.baz.']);
5758
});
59+
60+
test('should not fire on cursor move when the backing process is not on Windows', async () => {
61+
await writeP(xterm, 'foo.\x1b[H');
62+
deepStrictEqual(events, []);
63+
});
64+
65+
test('should fire on cursor move when the backing process is on Windows', async () => {
66+
lineDataEventAddon.setOperatingSystem(OperatingSystem.Windows);
67+
await writeP(xterm, 'foo\x1b[H');
68+
deepStrictEqual(events, ['foo']);
69+
});
5870
});
5971
});

0 commit comments

Comments
 (0)