@theia/api-tests 1.34.2 → 1.34.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +641 -641
- package/package.json +3 -3
- package/src/api-tests.d.ts +21 -21
- package/src/browser-utils.spec.js +53 -53
- package/src/contribution-filter.spec.js +36 -36
- package/src/file-search.spec.js +132 -132
- package/src/find-replace.spec.js +129 -129
- package/src/keybindings.spec.js +117 -117
- package/src/launch-preferences.spec.js +697 -697
- package/src/menus.spec.js +176 -176
- package/src/monaco-api.spec.js +188 -188
- package/src/navigator.spec.js +92 -92
- package/src/preferences.spec.js +207 -207
- package/src/saveable.spec.js +503 -503
- package/src/scm.spec.js +173 -173
- package/src/shell.spec.js +41 -41
- package/src/task-configurations.spec.js +112 -112
- package/src/typescript.spec.js +779 -779
- package/src/undo-redo-selectAll.spec.js +193 -193
- package/src/views.spec.js +76 -76
package/src/menus.spec.js
CHANGED
|
@@ -1,176 +1,176 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2020 TypeFox and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
// @ts-check
|
|
18
|
-
describe('Menus', function () {
|
|
19
|
-
this.timeout(7500);
|
|
20
|
-
|
|
21
|
-
const { assert } = chai;
|
|
22
|
-
|
|
23
|
-
const { BrowserMenuBarContribution } = require('@theia/core/lib/browser/menu/browser-menu-plugin');
|
|
24
|
-
const { MenuModelRegistry } = require('@theia/core/lib/common/menu');
|
|
25
|
-
const { CommandRegistry } = require('@theia/core/lib/common/command');
|
|
26
|
-
const { DisposableCollection } = require('@theia/core/lib/common/disposable');
|
|
27
|
-
const { ContextMenuRenderer } = require('@theia/core/lib/browser/context-menu-renderer');
|
|
28
|
-
const { BrowserContextMenuAccess } = require('@theia/core/lib/browser/menu/browser-context-menu-renderer');
|
|
29
|
-
const { ApplicationShell } = require('@theia/core/lib/browser/shell/application-shell');
|
|
30
|
-
const { ViewContainer } = require('@theia/core/lib/browser/view-container');
|
|
31
|
-
const { waitForRevealed, waitForHidden } = require('@theia/core/lib/browser/widgets/widget');
|
|
32
|
-
const { CallHierarchyContribution } = require('@theia/callhierarchy/lib/browser/callhierarchy-contribution');
|
|
33
|
-
const { EXPLORER_VIEW_CONTAINER_ID } = require('@theia/navigator/lib/browser/navigator-widget-factory');
|
|
34
|
-
const { FileNavigatorContribution } = require('@theia/navigator/lib/browser/navigator-contribution');
|
|
35
|
-
const { ScmContribution } = require('@theia/scm/lib/browser/scm-contribution');
|
|
36
|
-
const { ScmHistoryContribution } = require('@theia/scm-extra/lib/browser/history/scm-history-contribution');
|
|
37
|
-
const { OutlineViewContribution } = require('@theia/outline-view/lib/browser/outline-view-contribution');
|
|
38
|
-
const { OutputContribution } = require('@theia/output/lib/browser/output-contribution');
|
|
39
|
-
const { PluginFrontendViewContribution } = require('@theia/plugin-ext/lib/main/browser/plugin-frontend-view-contribution');
|
|
40
|
-
const { ProblemContribution } = require('@theia/markers/lib/browser/problem/problem-contribution');
|
|
41
|
-
const { PropertyViewContribution } = require('@theia/property-view/lib/browser/property-view-contribution');
|
|
42
|
-
const { SearchInWorkspaceFrontendContribution } = require('@theia/search-in-workspace/lib/browser/search-in-workspace-frontend-contribution');
|
|
43
|
-
const { HostedPluginSupport } = require('@theia/plugin-ext/lib/hosted/browser/hosted-plugin');
|
|
44
|
-
|
|
45
|
-
const container = window.theia.container;
|
|
46
|
-
const shell = container.get(ApplicationShell);
|
|
47
|
-
const menuBarContribution = container.get(BrowserMenuBarContribution);
|
|
48
|
-
const menuBar = /** @type {import('@theia/core/lib/browser/menu/browser-menu-plugin').MenuBarWidget} */ (menuBarContribution.menuBar);
|
|
49
|
-
const pluginService = container.get(HostedPluginSupport);
|
|
50
|
-
const menus = container.get(MenuModelRegistry);
|
|
51
|
-
const commands = container.get(CommandRegistry);
|
|
52
|
-
const contextMenuService = container.get(ContextMenuRenderer);
|
|
53
|
-
|
|
54
|
-
before(async function () {
|
|
55
|
-
await pluginService.didStart;
|
|
56
|
-
await pluginService.activateByViewContainer('explorer');
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
const toTearDown = new DisposableCollection();
|
|
60
|
-
afterEach(() => toTearDown.dispose());
|
|
61
|
-
|
|
62
|
-
for (const contribution of [
|
|
63
|
-
container.get(CallHierarchyContribution),
|
|
64
|
-
container.get(FileNavigatorContribution),
|
|
65
|
-
container.get(ScmContribution),
|
|
66
|
-
container.get(ScmHistoryContribution),
|
|
67
|
-
container.get(OutlineViewContribution),
|
|
68
|
-
container.get(OutputContribution),
|
|
69
|
-
container.get(PluginFrontendViewContribution),
|
|
70
|
-
container.get(ProblemContribution),
|
|
71
|
-
container.get(PropertyViewContribution),
|
|
72
|
-
container.get(SearchInWorkspaceFrontendContribution)
|
|
73
|
-
]) {
|
|
74
|
-
it(`should toggle '${contribution.viewLabel}' view`, async () => {
|
|
75
|
-
await contribution.closeView();
|
|
76
|
-
await menuBar.triggerMenuItem('View', contribution.viewLabel);
|
|
77
|
-
await shell.waitForActivation(contribution.viewId);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
it('reveal more context menu in the explorer view container toolbar', async function () {
|
|
82
|
-
const viewContainer = await shell.revealWidget(EXPLORER_VIEW_CONTAINER_ID);
|
|
83
|
-
if (!(viewContainer instanceof ViewContainer)) {
|
|
84
|
-
assert.isTrue(viewContainer instanceof ViewContainer);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const contribution = container.get(FileNavigatorContribution);
|
|
89
|
-
const waitForParts = [];
|
|
90
|
-
for (const part of viewContainer.getParts()) {
|
|
91
|
-
if (part.wrapped.id !== contribution.viewId) {
|
|
92
|
-
part.hide();
|
|
93
|
-
waitForParts.push(waitForHidden(part.wrapped));
|
|
94
|
-
} else {
|
|
95
|
-
part.show();
|
|
96
|
-
waitForParts.push(waitForRevealed(part.wrapped));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
await Promise.all(waitForParts);
|
|
100
|
-
|
|
101
|
-
const contextMenuAccess = shell.leftPanelHandler.toolBar.showMoreContextMenu({ x: 0, y: 0 });
|
|
102
|
-
toTearDown.push(contextMenuAccess);
|
|
103
|
-
if (!(contextMenuAccess instanceof BrowserContextMenuAccess)) {
|
|
104
|
-
assert.isTrue(contextMenuAccess instanceof BrowserContextMenuAccess);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const contextMenu = contextMenuAccess.menu;
|
|
108
|
-
|
|
109
|
-
await waitForRevealed(contextMenu);
|
|
110
|
-
assert.notEqual(contextMenu.items.length, 0);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('rendering a new context menu should close the current', async function () {
|
|
114
|
-
const commandId = '__test_command_' + new Date();
|
|
115
|
-
const contextMenuPath = ['__test_first_context_menu_' + new Date()];
|
|
116
|
-
const contextMenuPath2 = ['__test_second_context_menu_' + new Date()];
|
|
117
|
-
toTearDown.push(commands.registerCommand({
|
|
118
|
-
id: commandId,
|
|
119
|
-
label: commandId
|
|
120
|
-
}, {
|
|
121
|
-
execute: () => { }
|
|
122
|
-
}));
|
|
123
|
-
toTearDown.push(menus.registerMenuAction(contextMenuPath, { commandId }));
|
|
124
|
-
toTearDown.push(menus.registerMenuAction(contextMenuPath2, { commandId }));
|
|
125
|
-
|
|
126
|
-
const access = contextMenuService.render({
|
|
127
|
-
anchor: { x: 0, y: 0 },
|
|
128
|
-
menuPath: contextMenuPath
|
|
129
|
-
});
|
|
130
|
-
toTearDown.push(access);
|
|
131
|
-
if (!(access instanceof BrowserContextMenuAccess)) {
|
|
132
|
-
assert.isTrue(access instanceof BrowserContextMenuAccess);
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
assert.deepEqual(contextMenuService.current, access);
|
|
137
|
-
assert.isFalse(access.disposed);
|
|
138
|
-
|
|
139
|
-
await waitForRevealed(access.menu);
|
|
140
|
-
assert.notEqual(access.menu.items.length, 0);
|
|
141
|
-
assert.deepEqual(contextMenuService.current, access);
|
|
142
|
-
assert.isFalse(access.disposed);
|
|
143
|
-
|
|
144
|
-
const access2 = contextMenuService.render({
|
|
145
|
-
anchor: { x: 0, y: 0 },
|
|
146
|
-
menuPath: contextMenuPath2
|
|
147
|
-
});
|
|
148
|
-
toTearDown.push(access2);
|
|
149
|
-
if (!(access2 instanceof BrowserContextMenuAccess)) {
|
|
150
|
-
assert.isTrue(access2 instanceof BrowserContextMenuAccess);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
assert.deepEqual(contextMenuService.current, access2);
|
|
155
|
-
assert.isFalse(access2.disposed);
|
|
156
|
-
assert.isTrue(access.disposed);
|
|
157
|
-
|
|
158
|
-
await waitForRevealed(access2.menu);
|
|
159
|
-
assert.deepEqual(contextMenuService.current, access2);
|
|
160
|
-
assert.isFalse(access2.disposed);
|
|
161
|
-
assert.isTrue(access.disposed);
|
|
162
|
-
|
|
163
|
-
access2.dispose();
|
|
164
|
-
assert.deepEqual(contextMenuService.current, undefined);
|
|
165
|
-
assert.isTrue(access2.disposed);
|
|
166
|
-
|
|
167
|
-
await waitForHidden(access2.menu);
|
|
168
|
-
assert.deepEqual(contextMenuService.current, undefined);
|
|
169
|
-
assert.isTrue(access2.disposed);
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
it('should not fail to register a menu with an invalid command', () => {
|
|
173
|
-
assert.doesNotThrow(() => menus.registerMenuAction(['test-menu-path'], { commandId: 'invalid-command', label: 'invalid command' }), 'should not throw.');
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
});
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2020 TypeFox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
// @ts-check
|
|
18
|
+
describe('Menus', function () {
|
|
19
|
+
this.timeout(7500);
|
|
20
|
+
|
|
21
|
+
const { assert } = chai;
|
|
22
|
+
|
|
23
|
+
const { BrowserMenuBarContribution } = require('@theia/core/lib/browser/menu/browser-menu-plugin');
|
|
24
|
+
const { MenuModelRegistry } = require('@theia/core/lib/common/menu');
|
|
25
|
+
const { CommandRegistry } = require('@theia/core/lib/common/command');
|
|
26
|
+
const { DisposableCollection } = require('@theia/core/lib/common/disposable');
|
|
27
|
+
const { ContextMenuRenderer } = require('@theia/core/lib/browser/context-menu-renderer');
|
|
28
|
+
const { BrowserContextMenuAccess } = require('@theia/core/lib/browser/menu/browser-context-menu-renderer');
|
|
29
|
+
const { ApplicationShell } = require('@theia/core/lib/browser/shell/application-shell');
|
|
30
|
+
const { ViewContainer } = require('@theia/core/lib/browser/view-container');
|
|
31
|
+
const { waitForRevealed, waitForHidden } = require('@theia/core/lib/browser/widgets/widget');
|
|
32
|
+
const { CallHierarchyContribution } = require('@theia/callhierarchy/lib/browser/callhierarchy-contribution');
|
|
33
|
+
const { EXPLORER_VIEW_CONTAINER_ID } = require('@theia/navigator/lib/browser/navigator-widget-factory');
|
|
34
|
+
const { FileNavigatorContribution } = require('@theia/navigator/lib/browser/navigator-contribution');
|
|
35
|
+
const { ScmContribution } = require('@theia/scm/lib/browser/scm-contribution');
|
|
36
|
+
const { ScmHistoryContribution } = require('@theia/scm-extra/lib/browser/history/scm-history-contribution');
|
|
37
|
+
const { OutlineViewContribution } = require('@theia/outline-view/lib/browser/outline-view-contribution');
|
|
38
|
+
const { OutputContribution } = require('@theia/output/lib/browser/output-contribution');
|
|
39
|
+
const { PluginFrontendViewContribution } = require('@theia/plugin-ext/lib/main/browser/plugin-frontend-view-contribution');
|
|
40
|
+
const { ProblemContribution } = require('@theia/markers/lib/browser/problem/problem-contribution');
|
|
41
|
+
const { PropertyViewContribution } = require('@theia/property-view/lib/browser/property-view-contribution');
|
|
42
|
+
const { SearchInWorkspaceFrontendContribution } = require('@theia/search-in-workspace/lib/browser/search-in-workspace-frontend-contribution');
|
|
43
|
+
const { HostedPluginSupport } = require('@theia/plugin-ext/lib/hosted/browser/hosted-plugin');
|
|
44
|
+
|
|
45
|
+
const container = window.theia.container;
|
|
46
|
+
const shell = container.get(ApplicationShell);
|
|
47
|
+
const menuBarContribution = container.get(BrowserMenuBarContribution);
|
|
48
|
+
const menuBar = /** @type {import('@theia/core/lib/browser/menu/browser-menu-plugin').MenuBarWidget} */ (menuBarContribution.menuBar);
|
|
49
|
+
const pluginService = container.get(HostedPluginSupport);
|
|
50
|
+
const menus = container.get(MenuModelRegistry);
|
|
51
|
+
const commands = container.get(CommandRegistry);
|
|
52
|
+
const contextMenuService = container.get(ContextMenuRenderer);
|
|
53
|
+
|
|
54
|
+
before(async function () {
|
|
55
|
+
await pluginService.didStart;
|
|
56
|
+
await pluginService.activateByViewContainer('explorer');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const toTearDown = new DisposableCollection();
|
|
60
|
+
afterEach(() => toTearDown.dispose());
|
|
61
|
+
|
|
62
|
+
for (const contribution of [
|
|
63
|
+
container.get(CallHierarchyContribution),
|
|
64
|
+
container.get(FileNavigatorContribution),
|
|
65
|
+
container.get(ScmContribution),
|
|
66
|
+
container.get(ScmHistoryContribution),
|
|
67
|
+
container.get(OutlineViewContribution),
|
|
68
|
+
container.get(OutputContribution),
|
|
69
|
+
container.get(PluginFrontendViewContribution),
|
|
70
|
+
container.get(ProblemContribution),
|
|
71
|
+
container.get(PropertyViewContribution),
|
|
72
|
+
container.get(SearchInWorkspaceFrontendContribution)
|
|
73
|
+
]) {
|
|
74
|
+
it(`should toggle '${contribution.viewLabel}' view`, async () => {
|
|
75
|
+
await contribution.closeView();
|
|
76
|
+
await menuBar.triggerMenuItem('View', contribution.viewLabel);
|
|
77
|
+
await shell.waitForActivation(contribution.viewId);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
it('reveal more context menu in the explorer view container toolbar', async function () {
|
|
82
|
+
const viewContainer = await shell.revealWidget(EXPLORER_VIEW_CONTAINER_ID);
|
|
83
|
+
if (!(viewContainer instanceof ViewContainer)) {
|
|
84
|
+
assert.isTrue(viewContainer instanceof ViewContainer);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const contribution = container.get(FileNavigatorContribution);
|
|
89
|
+
const waitForParts = [];
|
|
90
|
+
for (const part of viewContainer.getParts()) {
|
|
91
|
+
if (part.wrapped.id !== contribution.viewId) {
|
|
92
|
+
part.hide();
|
|
93
|
+
waitForParts.push(waitForHidden(part.wrapped));
|
|
94
|
+
} else {
|
|
95
|
+
part.show();
|
|
96
|
+
waitForParts.push(waitForRevealed(part.wrapped));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
await Promise.all(waitForParts);
|
|
100
|
+
|
|
101
|
+
const contextMenuAccess = shell.leftPanelHandler.toolBar.showMoreContextMenu({ x: 0, y: 0 });
|
|
102
|
+
toTearDown.push(contextMenuAccess);
|
|
103
|
+
if (!(contextMenuAccess instanceof BrowserContextMenuAccess)) {
|
|
104
|
+
assert.isTrue(contextMenuAccess instanceof BrowserContextMenuAccess);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const contextMenu = contextMenuAccess.menu;
|
|
108
|
+
|
|
109
|
+
await waitForRevealed(contextMenu);
|
|
110
|
+
assert.notEqual(contextMenu.items.length, 0);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('rendering a new context menu should close the current', async function () {
|
|
114
|
+
const commandId = '__test_command_' + new Date();
|
|
115
|
+
const contextMenuPath = ['__test_first_context_menu_' + new Date()];
|
|
116
|
+
const contextMenuPath2 = ['__test_second_context_menu_' + new Date()];
|
|
117
|
+
toTearDown.push(commands.registerCommand({
|
|
118
|
+
id: commandId,
|
|
119
|
+
label: commandId
|
|
120
|
+
}, {
|
|
121
|
+
execute: () => { }
|
|
122
|
+
}));
|
|
123
|
+
toTearDown.push(menus.registerMenuAction(contextMenuPath, { commandId }));
|
|
124
|
+
toTearDown.push(menus.registerMenuAction(contextMenuPath2, { commandId }));
|
|
125
|
+
|
|
126
|
+
const access = contextMenuService.render({
|
|
127
|
+
anchor: { x: 0, y: 0 },
|
|
128
|
+
menuPath: contextMenuPath
|
|
129
|
+
});
|
|
130
|
+
toTearDown.push(access);
|
|
131
|
+
if (!(access instanceof BrowserContextMenuAccess)) {
|
|
132
|
+
assert.isTrue(access instanceof BrowserContextMenuAccess);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
assert.deepEqual(contextMenuService.current, access);
|
|
137
|
+
assert.isFalse(access.disposed);
|
|
138
|
+
|
|
139
|
+
await waitForRevealed(access.menu);
|
|
140
|
+
assert.notEqual(access.menu.items.length, 0);
|
|
141
|
+
assert.deepEqual(contextMenuService.current, access);
|
|
142
|
+
assert.isFalse(access.disposed);
|
|
143
|
+
|
|
144
|
+
const access2 = contextMenuService.render({
|
|
145
|
+
anchor: { x: 0, y: 0 },
|
|
146
|
+
menuPath: contextMenuPath2
|
|
147
|
+
});
|
|
148
|
+
toTearDown.push(access2);
|
|
149
|
+
if (!(access2 instanceof BrowserContextMenuAccess)) {
|
|
150
|
+
assert.isTrue(access2 instanceof BrowserContextMenuAccess);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
assert.deepEqual(contextMenuService.current, access2);
|
|
155
|
+
assert.isFalse(access2.disposed);
|
|
156
|
+
assert.isTrue(access.disposed);
|
|
157
|
+
|
|
158
|
+
await waitForRevealed(access2.menu);
|
|
159
|
+
assert.deepEqual(contextMenuService.current, access2);
|
|
160
|
+
assert.isFalse(access2.disposed);
|
|
161
|
+
assert.isTrue(access.disposed);
|
|
162
|
+
|
|
163
|
+
access2.dispose();
|
|
164
|
+
assert.deepEqual(contextMenuService.current, undefined);
|
|
165
|
+
assert.isTrue(access2.disposed);
|
|
166
|
+
|
|
167
|
+
await waitForHidden(access2.menu);
|
|
168
|
+
assert.deepEqual(contextMenuService.current, undefined);
|
|
169
|
+
assert.isTrue(access2.disposed);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('should not fail to register a menu with an invalid command', () => {
|
|
173
|
+
assert.doesNotThrow(() => menus.registerMenuAction(['test-menu-path'], { commandId: 'invalid-command', label: 'invalid command' }), 'should not throw.');
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
});
|