@theia/api-tests 1.26.0-next.13 → 1.26.0-next.14

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.13+f249b3e9378",
3
+ "version": "1.26.0-next.14+2ecc3c507b0",
4
4
  "description": "Theia API tests",
5
5
  "dependencies": {
6
- "@theia/core": "1.26.0-next.13+f249b3e9378"
6
+ "@theia/core": "1.26.0-next.14+2ecc3c507b0"
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": "f249b3e93787905d960d7e428f2da0c1796b76d3"
23
+ "gitHead": "2ecc3c507b0f680be2c6f6b0699e9ab1931cb3d4"
24
24
  }
@@ -576,17 +576,17 @@ DIV {
576
576
  assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'DemoClass');
577
577
  });
578
578
 
579
- // TODO: FIXME! As of 28/01/2022 this test is failing or timing out for unknown reasons.
580
- it.skip('run reference code lens', async function () {
581
- this.timeout(300_000); // 5 min (give time to `tsserver` to initialize and then respond to make this test pass.)
582
- const globalValue = preferences.inspect('javascript.referencesCodeLens.enabled').globalValue;
583
- toTearDown.push({ dispose: () => preferences.set('javascript.referencesCodeLens.enabled', globalValue, PreferenceScope.User) });
579
+ it('run reference code lens', async function () {
580
+ const preferenceName = 'typescript.referencesCodeLens.enabled';
581
+ const globalValue = preferences.inspect(preferenceName).globalValue;
582
+ toTearDown.push({ dispose: () => preferences.set(preferenceName, globalValue, PreferenceScope.User) });
583
+ await preferences.set(preferenceName, false, PreferenceScope.User);
584
584
 
585
585
  const editor = await openEditor(demoFileUri);
586
586
 
587
- /** @type any */
587
+ /** @type {import('@theia/monaco-editor-core/src/vs/editor/contrib/codelens/browser/codelensController').CodeLensContribution} */
588
588
  const codeLens = editor.getControl().getContribution('css.editor.codeLens');
589
- const codeLensNode = () => codeLens._lenses[0] && codeLens._lenses[0]._contentWidget && codeLens._lenses[0]._contentWidget._domNode;
589
+ const codeLensNode = () => codeLens['_lenses'][0]?.['_contentWidget']?.['_domNode'];
590
590
  const codeLensNodeVisible = () => {
591
591
  const n = codeLensNode();
592
592
  return !!n && n.style.visibility !== 'hidden';
@@ -594,46 +594,28 @@ DIV {
594
594
 
595
595
  assert.isFalse(codeLensNodeVisible());
596
596
 
597
- // [export ]function load(raw) {
598
- const position = { lineNumber: 16, column: 1 };
599
- editor.getControl().getModel().applyEdits([{
600
- range: Range.fromPositions(position, position),
601
- forceMoveMarkers: false,
602
- text: 'export '
603
- }]);
604
- await preferences.set('javascript.referencesCodeLens.enabled', true, PreferenceScope.User);
605
-
606
- // Recall `applyEdits` to workaround `vscode` bug, See: https://github.com/eclipse-theia/theia/issues/9714#issuecomment-876582947.
607
- editor.getControl().getModel().applyEdits([{
608
- range: Range.fromPositions(position, position),
609
- forceMoveMarkers: false,
610
- text: ' '
611
- }]);
597
+ // |interface DemoInterface {
598
+ const position = { lineNumber: 2, column: 1 };
599
+ await preferences.set(preferenceName, true, PreferenceScope.User);
612
600
 
613
601
  editor.getControl().revealPosition(position);
614
602
  await waitForAnimation(() => codeLensNodeVisible());
615
603
 
616
604
  assert.isTrue(codeLensNodeVisible());
617
605
  const node = codeLensNode();
618
- if (node) {
619
- assert.equal(nodeAsString(node), `
606
+ assert.isDefined(node);
607
+ assert.equal(nodeAsString(node), `
620
608
  SPAN {
621
609
  A {
622
- "20 references"
610
+ "1 reference"
623
611
  }
624
612
  }
625
613
  `);
626
- const link = node.getElementsByTagName('a').item(0);
627
- if (link) {
628
- link.dispatchEvent(new MouseEvent('mousedown', { bubbles: true }));
629
- await assertPeekOpened(editor);
630
- await closePeek(editor);
631
- } else {
632
- assert.isDefined(link);
633
- }
634
- } else {
635
- assert.isDefined(node);
636
- }
614
+ const link = node.getElementsByTagName('a').item(0);
615
+ assert.isDefined(link);
616
+ link.dispatchEvent(new MouseEvent('mousedown', { bubbles: true }));
617
+ await assertPeekOpened(editor);
618
+ await closePeek(editor);
637
619
  });
638
620
 
639
621
  it('editor.action.quickFix', async function () {
@@ -32,6 +32,7 @@ describe('Undo, Redo and Select All', function () {
32
32
  const { MonacoEditor } = require('@theia/monaco/lib/browser/monaco-editor');
33
33
  const { ScmContribution } = require('@theia/scm/lib/browser/scm-contribution');
34
34
  const { Range } = require('@theia/monaco-editor-core/esm/vs/editor/common/core/range');
35
+ const { PreferenceService, PreferenceScope } = require('@theia/core/lib/browser');
35
36
 
36
37
  const container = window.theia.container;
37
38
  const editorManager = container.get(EditorManager);
@@ -41,6 +42,8 @@ describe('Undo, Redo and Select All', function () {
41
42
  const navigatorContribution = container.get(FileNavigatorContribution);
42
43
  const shell = container.get(ApplicationShell);
43
44
  const scmContribution = container.get(ScmContribution);
45
+ /** @type {PreferenceService} */
46
+ const preferenceService = container.get(PreferenceService)
44
47
 
45
48
  const rootUri = workspaceService.tryGetRoots()[0].resource;
46
49
  const fileUri = rootUri.resolve('webpack.config.js');
@@ -61,8 +64,10 @@ describe('Undo, Redo and Select All', function () {
61
64
  resolve(undefined);
62
65
  });
63
66
  }
64
-
65
- before(() => {
67
+ let originalValue = undefined;
68
+ before(async () => {
69
+ originalValue = preferenceService.inspect('files.autoSave').globalValue;
70
+ await preferenceService.set('files.autoSave', false, PreferenceScope.User);
66
71
  shell.leftPanelHandler.collapse();
67
72
  });
68
73
 
@@ -79,7 +84,8 @@ describe('Undo, Redo and Select All', function () {
79
84
  await editorManager.closeAll({ save: false });
80
85
  });
81
86
 
82
- after(() => {
87
+ after(async () => {
88
+ await preferenceService.set('files.autoSave', originalValue, PreferenceScope.User);
83
89
  shell.leftPanelHandler.collapse();
84
90
  });
85
91