@theia/api-tests 1.26.0-next.23 → 1.26.0-next.26
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/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/api-tests",
|
|
3
|
-
"version": "1.26.0-next.
|
|
3
|
+
"version": "1.26.0-next.26+c4e55ec01ed",
|
|
4
4
|
"description": "Theia API tests",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.26.0-next.
|
|
6
|
+
"@theia/core": "1.26.0-next.26+c4e55ec01ed"
|
|
7
7
|
},
|
|
8
8
|
"license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0",
|
|
9
9
|
"repository": {
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "c4e55ec01ed50e67f3cdf029685207a132cb4a27"
|
|
24
24
|
}
|
package/src/preferences.spec.js
CHANGED
|
@@ -66,6 +66,13 @@ describe('Preferences', function () {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
async function deleteAllValues() {
|
|
69
|
+
return setValueTo(undefined);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @param {any} value - A JSON value to write to the workspace preference file.
|
|
74
|
+
*/
|
|
75
|
+
async function setValueTo(value) {
|
|
69
76
|
const reference = await modelService.createModelReference(uri);
|
|
70
77
|
if (reference.object.dirty) {
|
|
71
78
|
await reference.object.revert();
|
|
@@ -73,7 +80,7 @@ describe('Preferences', function () {
|
|
|
73
80
|
/** @type {import ('@theia/preferences/lib/browser/folder-preference-provider').FolderPreferenceProvider} */
|
|
74
81
|
const provider = Array.from(folderPreferences['providers'].values()).find(candidate => candidate.getConfigUri().isEqual(uri));
|
|
75
82
|
assert.isDefined(provider);
|
|
76
|
-
await provider['doSetPreference']('', [],
|
|
83
|
+
await provider['doSetPreference']('', [], value);
|
|
77
84
|
reference.dispose();
|
|
78
85
|
}
|
|
79
86
|
|
|
@@ -92,7 +99,10 @@ describe('Preferences', function () {
|
|
|
92
99
|
if (!fileExistsBeforehand) {
|
|
93
100
|
await fileService.delete(uri, { fromUserGesture: false }).catch(() => { });
|
|
94
101
|
} else {
|
|
95
|
-
|
|
102
|
+
let content = '';
|
|
103
|
+
try { content = JSON.parse(contentBeforehand); } catch { }
|
|
104
|
+
// Use the preference service because its promise is guaranteed to resolve after the file change is complete.
|
|
105
|
+
await setValueTo(content);
|
|
96
106
|
}
|
|
97
107
|
});
|
|
98
108
|
|
package/src/typescript.spec.js
CHANGED
|
@@ -48,6 +48,7 @@ describe('TypeScript', function () {
|
|
|
48
48
|
const contextKeyService = container.get(ContextKeyService);
|
|
49
49
|
const commands = container.get(CommandRegistry);
|
|
50
50
|
const openerService = container.get(OpenerService);
|
|
51
|
+
/** @type {KeybindingRegistry} */
|
|
51
52
|
const keybindings = container.get(KeybindingRegistry);
|
|
52
53
|
/** @type {import('@theia/core/lib/browser/preferences/preference-service').PreferenceService} */
|
|
53
54
|
const preferences = container.get(PreferenceService);
|
|
@@ -108,11 +109,12 @@ describe('TypeScript', function () {
|
|
|
108
109
|
/**
|
|
109
110
|
* @param {() => Promise<unknown> | unknown} condition
|
|
110
111
|
* @param {number | undefined} [timeout]
|
|
112
|
+
* @param {string | undefined} [message]
|
|
111
113
|
* @returns {Promise<void>}
|
|
112
114
|
*/
|
|
113
|
-
function waitForAnimation(condition, timeout) {
|
|
114
|
-
const success = new Promise(async (resolve,
|
|
115
|
-
toTearDown.push({ dispose });
|
|
115
|
+
function waitForAnimation(condition, timeout, message) {
|
|
116
|
+
const success = new Promise(async (resolve, reject) => {
|
|
117
|
+
toTearDown.push({ dispose: () => reject(message ?? 'Test terminated before resolution.') });
|
|
116
118
|
do {
|
|
117
119
|
await animationFrame();
|
|
118
120
|
} while (!condition());
|
|
@@ -120,8 +122,8 @@ describe('TypeScript', function () {
|
|
|
120
122
|
});
|
|
121
123
|
if (timeout !== undefined) {
|
|
122
124
|
const timedOut = new Promise((_, fail) => {
|
|
123
|
-
const toClear = setTimeout(() => fail(new Error('Wait for animation timed out.')), timeout);
|
|
124
|
-
toTearDown.push({ dispose: () => (fail(new Error('Wait for animation timed out.')), clearTimeout(toClear)) });
|
|
125
|
+
const toClear = setTimeout(() => fail(new Error(message ?? 'Wait for animation timed out.')), timeout);
|
|
126
|
+
toTearDown.push({ dispose: () => (fail(new Error(message ?? 'Wait for animation timed out.')), clearTimeout(toClear)) });
|
|
125
127
|
});
|
|
126
128
|
return Promise.race([success, timedOut]);
|
|
127
129
|
}
|
|
@@ -277,6 +279,7 @@ describe('TypeScript', function () {
|
|
|
277
279
|
const from = 'an editor' + (preview ? ' preview' : '');
|
|
278
280
|
it('within ' + from, async function () {
|
|
279
281
|
const editor = await openEditor(demoFileUri, preview);
|
|
282
|
+
editor.getControl().revealLine(24);
|
|
280
283
|
// const demoInstance = new Demo|Class('demo');
|
|
281
284
|
editor.getControl().setPosition({ lineNumber: 24, column: 30 });
|
|
282
285
|
assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'DemoClass');
|
|
@@ -299,6 +302,7 @@ describe('TypeScript', function () {
|
|
|
299
302
|
await editorManager.open(definitionFileUri, { mode: 'open' });
|
|
300
303
|
|
|
301
304
|
const editor = await openEditor(demoFileUri, preview);
|
|
305
|
+
editor.getControl().revealLine(32);
|
|
302
306
|
// const bar: Defined|Interface = { coolField: [] };
|
|
303
307
|
editor.getControl().setPosition({ lineNumber: 32, column: 19 });
|
|
304
308
|
assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'DefinedInterface');
|
|
@@ -319,6 +323,7 @@ describe('TypeScript', function () {
|
|
|
319
323
|
|
|
320
324
|
it(`from ${from} to an editor preview`, async function () {
|
|
321
325
|
const editor = await openEditor(demoFileUri);
|
|
326
|
+
editor.getControl().revealLine(32);
|
|
322
327
|
// const bar: Defined|Interface = { coolField: [] };
|
|
323
328
|
editor.getControl().setPosition({ lineNumber: 32, column: 19 });
|
|
324
329
|
assert.equal(editor.getControl().getModel().getWordAtPosition(editor.getControl().getPosition()).word, 'DefinedInterface');
|
|
@@ -729,5 +734,4 @@ SPAN {
|
|
|
729
734
|
assert.equal(getResultText(), expectedMessage);
|
|
730
735
|
});
|
|
731
736
|
}
|
|
732
|
-
|
|
733
737
|
});
|
|
@@ -67,7 +67,7 @@ describe('Undo, Redo and Select All', function () {
|
|
|
67
67
|
let originalValue = undefined;
|
|
68
68
|
before(async () => {
|
|
69
69
|
originalValue = preferenceService.inspect('files.autoSave').globalValue;
|
|
70
|
-
await preferenceService.set('files.autoSave',
|
|
70
|
+
await preferenceService.set('files.autoSave', 'off', PreferenceScope.User);
|
|
71
71
|
shell.leftPanelHandler.collapse();
|
|
72
72
|
});
|
|
73
73
|
|