make sure to return initial value, #11503

This commit is contained in:
Johannes Rieken
2016-09-19 16:28:04 +02:00
parent 0842812f73
commit 203055c6da
2 changed files with 18 additions and 1 deletions

View File

@@ -180,6 +180,14 @@ suite('window namespace tests', () => {
]);
});
test('showInputBox - default value on Enter', function () {
const p = window.showInputBox({ value: 'farboo' });
return Promise.all<any>([
p.then(value => assert.equal(value, 'farboo')),
commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem'),
]);
});
test('showInputBox - `undefined` on Esc', function () {
const p = window.showInputBox();
return Promise.all<any>([
@@ -188,6 +196,15 @@ suite('window namespace tests', () => {
]);
});
test('showInputBox - `undefined` on Esc (despite default)', function () {
const p = window.showInputBox({ value: 'farboo' });
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);