Skip to content

Commit

Permalink
make sure that the falsy value for the activeTextEditor is undefined,
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Apr 6, 2016
1 parent 8bced8e commit 78dcfe1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions extensions/vscode-api-tests/src/window.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 => {
Expand All @@ -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)),
Expand All @@ -74,7 +79,7 @@ suite("window namespace tests", () => {
assert.ok(actualEvent.viewColumn === two.viewColumn);

registration1.dispose();
})
});
});
});
});
2 changes: 1 addition & 1 deletion src/vs/workbench/api/node/extHostEditors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] {
Expand Down

0 comments on commit 78dcfe1

Please sign in to comment.