don't push code without tests... #8093

This commit is contained in:
Johannes Rieken 2016-08-12 12:32:15 +02:00
parent ed26ad524e
commit a8a920e2fc
2 changed files with 23 additions and 1 deletions

View file

@ -6,7 +6,7 @@
'use strict';
import * as assert from 'assert';
import {workspace, window, ViewColumn, TextEditorViewColumnChangeEvent, Uri, Selection, Position, CancellationTokenSource} from 'vscode';
import {workspace, window, ViewColumn, TextEditorViewColumnChangeEvent, Uri, Selection, Position, CancellationTokenSource, TextEditorSelectionChangeKind} from 'vscode';
import {join} from 'path';
import {cleanUp, pathEquals} from './utils';
@ -189,4 +189,24 @@ suite('window namespace tests', () => {
assert.equal(value, undefined);
});
});
test('editor, selection change kind', () => {
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => window.showTextDocument(doc)).then(editor => {
return new Promise((resolve, reject) => {
let subscription = window.onDidChangeTextEditorSelection(e => {
assert.ok(e.textEditor === editor);
assert.equal(e.kind, TextEditorSelectionChangeKind.Command);
subscription.dispose();
resolve();
});
editor.selection = new Selection(editor.selection.anchor, editor.selection.active.translate(2));
});
});
});
});

View file

@ -80,6 +80,7 @@ export class ExtHostAPIImplementation {
TextEditorRevealType: typeof vscode.TextEditorRevealType;
EndOfLine: typeof vscode.EndOfLine;
TextEditorCursorStyle: typeof vscode.TextEditorCursorStyle;
TextEditorSelectionChangeKind: typeof vscode.TextEditorSelectionChangeKind;
commands: typeof vscode.commands;
window: typeof vscode.window;
workspace: typeof vscode.workspace;
@ -159,6 +160,7 @@ export class ExtHostAPIImplementation {
this.TextEditorRevealType = extHostTypes.TextEditorRevealType;
this.EndOfLine = extHostTypes.EndOfLine;
this.TextEditorCursorStyle = EditorCommon.TextEditorCursorStyle;
this.TextEditorSelectionChangeKind = extHostTypes.TextEditorSelectionChangeKind;
// env namespace
let telemetryInfo: ITelemetryInfo;