Skip to content

Commit

Permalink
don't push code without tests... #8093
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Aug 12, 2016
1 parent ed26ad5 commit a8a920e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 21 additions & 1 deletion extensions/vscode-api-tests/src/window.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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));
});

});
});
});
2 changes: 2 additions & 0 deletions src/vs/workbench/api/node/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a8a920e

Please sign in to comment.