forked from microsoft/vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QuickInput Proposed API (microsoft#49340)
- Loading branch information
Showing
13 changed files
with
1,426 additions
and
502 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
extensions/vscode-api-tests/src/singlefolder-tests/quickInput.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
'use strict'; | ||
|
||
import * as assert from 'assert'; | ||
import { window, commands } from 'vscode'; | ||
import { closeAllEditors } from '../utils'; | ||
|
||
suite('window namespace tests', function () { | ||
|
||
suite('QuickInput tests', function () { | ||
teardown(closeAllEditors); | ||
|
||
test('createQuickPick, select second', function (_done) { | ||
let done = (err?: any) => { | ||
done = () => {}; | ||
_done(err); | ||
}; | ||
const quickPick = window.createQuickPick(); | ||
const expectedFocusChanges = [['eins'], ['zwei']]; | ||
quickPick.onDidChangeActive(items => { | ||
try { | ||
assert.deepEqual(items.map(item => item.label), expectedFocusChanges.shift()); | ||
} catch (err) { | ||
done(err); | ||
} | ||
}); | ||
quickPick.onDidAccept(() => { | ||
try { | ||
const items = quickPick.activeItems; | ||
quickPick.dispose(); | ||
assert.equal(items.length, 1); | ||
assert.equal(items[0].label, 'zwei'); | ||
assert.equal(expectedFocusChanges.length, 0); | ||
done(); | ||
} catch (err) { | ||
done(err); | ||
} | ||
}); | ||
quickPick.items = ['eins', 'zwei', 'drei'].map(label => ({ label })); | ||
quickPick.show(); | ||
|
||
(async () => { | ||
await commands.executeCommand('workbench.action.quickOpenSelectNext'); | ||
await commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem'); | ||
})() | ||
.catch(err => done(err)); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.