make sure that the falsy value for the activeTextEditor is undefined, #5022

This commit is contained in:
Johannes Rieken 2016-04-06 17:42:59 +02:00
parent 8bced8eac0
commit 78dcfe10d8
2 changed files with 10 additions and 5 deletions

View file

@ -6,11 +6,11 @@
'use strict';
import * as assert from 'assert';
import {workspace, window, commands, ViewColumn, TextEditor, TextEditorViewColumnChangeEvent, Uri} from 'vscode';
import {workspace, window, ViewColumn, TextEditorViewColumnChangeEvent, Uri} from 'vscode';
import {join} from 'path';
import {cleanUp, pathEquals} from './utils';
suite("window namespace tests", () => {
suite('window namespace tests', () => {
teardown(cleanUp);
@ -24,6 +24,11 @@ suite("window namespace tests", () => {
});
});
test('editor, UN-active text editor', () => {
assert.equal(window.visibleTextEditors.length, 0);
assert.ok(window.activeTextEditor === undefined);
});
test('editor, assign and check view columns', () => {
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => {
@ -48,7 +53,7 @@ suite("window namespace tests", () => {
provideTextDocumentContent() {
return 'mountainbiking,roadcycling';
}
})
});
return Promise.all([
workspace.openTextDocument(Uri.parse('bikes://testing/one')).then(doc => window.showTextDocument(doc, ViewColumn.One)),
@ -74,7 +79,7 @@ suite("window namespace tests", () => {
assert.ok(actualEvent.viewColumn === two.viewColumn);
registration1.dispose();
})
});
});
});
});

View file

@ -77,7 +77,7 @@ export class ExtHostEditors {
}
getActiveTextEditor(): vscode.TextEditor {
return this._activeEditorId && this._editors[this._activeEditorId];
return this._editors[this._activeEditorId];
}
getVisibleTextEditors(): vscode.TextEditor[] {