disconnect token on promise resolve/reject, cancel picker on next picker, fixes #11172

This commit is contained in:
Johannes Rieken
2016-08-31 09:12:21 +02:00
parent 1de4d832cc
commit 182764c361
3 changed files with 43 additions and 4 deletions

View File

@@ -206,6 +206,32 @@ suite('window namespace tests', () => {
});
});
test('showQuickPick, canceled by another picker', function () {
const result = window.showQuickPick(['eins', 'zwei', 'drei'], { ignoreFocusOut: true }).then(result => {
assert.equal(result, undefined);
});
const source = new CancellationTokenSource();
source.cancel();
window.showQuickPick(['eins', 'zwei', 'drei'], undefined, source.token);
return result;
});
test('showQuickPick, canceled by input', function () {
const result = window.showQuickPick(['eins', 'zwei', 'drei'], { ignoreFocusOut: true }).then(result => {
assert.equal(result, undefined);
});
const source = new CancellationTokenSource();
source.cancel();
window.showInputBox(undefined, source.token);
return result;
});
test('editor, selection change kind', () => {
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => window.showTextDocument(doc)).then(editor => {