tests for undefined vs '', #10640

This commit is contained in:
Johannes Rieken
2016-08-18 21:57:26 +02:00
parent b639303aff
commit 9cb04a03c8

View File

@@ -6,7 +6,7 @@
'use strict';
import * as assert from 'assert';
import {workspace, window, ViewColumn, TextEditorViewColumnChangeEvent, Uri, Selection, Position, CancellationTokenSource, TextEditorSelectionChangeKind} from 'vscode';
import {workspace, window, commands, ViewColumn, TextEditorViewColumnChangeEvent, Uri, Selection, Position, CancellationTokenSource, TextEditorSelectionChangeKind} from 'vscode';
import {join} from 'path';
import {cleanUp, pathEquals} from './utils';
@@ -172,6 +172,22 @@ suite('window namespace tests', () => {
});
});
test('showInputBox - \'\' on Enter', function () {
const p = window.showInputBox();
return Promise.all<any>([
commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem'),
p.then(value => assert.equal(value, ''))
]);
});
test('showInputBox - `undefined` on Esc', function () {
const p = window.showInputBox();
return Promise.all<any>([
commands.executeCommand('workbench.action.closeQuickOpen'),
p.then(value => assert.equal(value, undefined))
]);
});
test('showQuickPick, undefined on cancel', function () {
const source = new CancellationTokenSource();
const p = window.showQuickPick(['eins', 'zwei', 'drei'], undefined, source.token);