Skip to content

Commit

Permalink
[CI] Add a testcase to test context key "inQuickOpen"
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Dumais <[email protected]>
  • Loading branch information
FernandoAscencio committed Apr 17, 2023
1 parent be82365 commit 346cab1
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion examples/api-tests/src/monaco-api.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ describe('Monaco API', async function () {
const { TokenizationRegistry } = require('@theia/monaco-editor-core/esm/vs/editor/common/languages');
const { MonacoContextKeyService } = require('@theia/monaco/lib/browser/monaco-context-key-service');
const { URI } = require('@theia/monaco-editor-core/esm/vs/base/common/uri');

const { animationFrame } = require('@theia/core/lib/browser/browser');

const container = window.theia.container;
const editorManager = container.get(EditorManager);
const workspaceService = container.get(WorkspaceService);
Expand Down Expand Up @@ -185,4 +186,20 @@ describe('Monaco API', async function () {
assert.isTrue(contextKeys.match(`${key} == ${secondValue}`));
});

it('Supports context key: inQuickOpen', async () => {
const inQuickOpenContextKey = 'inQuickOpen';
const quickOpenCommands = ['file-search.openFile', 'workbench.action.showCommands'];
const CommandThatChangesFocus = 'workbench.files.action.focusFilesExplorer';

for (const cmd of quickOpenCommands) {
assert.isFalse(contextKeys.match(inQuickOpenContextKey));
await commands.executeCommand(cmd);
assert.isTrue(contextKeys.match(inQuickOpenContextKey));

await commands.executeCommand(CommandThatChangesFocus);
await animationFrame();
assert.isFalse(contextKeys.match(inQuickOpenContextKey));
}
});

});

0 comments on commit 346cab1

Please sign in to comment.