Some clean up

This commit is contained in:
Daniel Imms
2019-08-05 15:03:31 -07:00
parent 25fe980387
commit 0eed3275f6
3 changed files with 47 additions and 25 deletions

View File

@@ -229,7 +229,7 @@ suite('window namespace tests', () => {
const terminal = window.createTerminal({ name: 'foo', pty });
});
test('should fire provide dimensions on start as the terminal has been shown', (done) => {
test('should not provide dimensions on start as the terminal has not been shown yet', (done) => {
const reg1 = window.onDidOpenTerminal(term => {
equal(terminal, term);
reg1.dispose();
@@ -237,6 +237,32 @@ suite('window namespace tests', () => {
const pty: Pseudoterminal = {
onDidWrite: new EventEmitter<string>().event,
open: (dimensions) => {
equal(dimensions, undefined);
const reg3 = window.onDidCloseTerminal(() => {
reg3.dispose();
done();
});
// Show a terminal and wait a brief period before dispose, this will cause
// the panel to init it's dimenisons and be provided to following terminals.
// The following test depends on this.
terminal.show();
setTimeout(() => terminal.dispose(), 200);
},
close: () => {}
};
const terminal = window.createTerminal({ name: 'foo', pty });
});
test('should provide dimensions on start as the terminal has been shown', (done) => {
const reg1 = window.onDidOpenTerminal(term => {
equal(terminal, term);
reg1.dispose();
});
const pty: Pseudoterminal = {
onDidWrite: new EventEmitter<string>().event,
open: (dimensions) => {
// This test depends on Terminal.show being called some time before such
// that the panel dimensions are initialized and cached.
ok(dimensions!.columns > 0);
ok(dimensions!.rows > 0);
const reg3 = window.onDidCloseTerminal(() => {