Add showTextDocument(uri|file)

This commit is contained in:
Benjamin Pasero
2017-07-17 07:54:23 +02:00
parent 3cfa565abb
commit 955e4b8c06
4 changed files with 61 additions and 5 deletions

View File

@@ -24,6 +24,24 @@ suite('window namespace tests', () => {
});
});
test('editor, opened via fileName', () => {
const fileName = join(workspace.rootPath || '', './far.js');
return window.showTextDocument(fileName).then((editor) => {
const active = window.activeTextEditor;
assert.ok(active);
assert.ok(pathEquals(active!.document.uri.fsPath, fileName));
});
});
test('editor, opened via resource', () => {
const uri = Uri.file(join(workspace.rootPath || '', './far.js'));
return window.showTextDocument(uri).then((editor) => {
const active = window.activeTextEditor;
assert.ok(active);
assert.ok(pathEquals(active!.document.uri.fsPath, uri.fsPath));
});
});
// test('editor, UN-active text editor', () => {
// assert.equal(window.visibleTextEditors.length, 0);
// assert.ok(window.activeTextEditor === undefined);