@theia/api-tests 1.27.0-next.23 → 1.27.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.27.0-next.23+039811643e5",
3
+ "version": "1.27.0-next.26+4e882720cfd",
4
4
  "description": "Theia API tests",
5
5
  "dependencies": {
6
- "@theia/core": "1.27.0-next.23+039811643e5"
6
+ "@theia/core": "1.27.0-next.26+4e882720cfd"
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": "039811643e59d31447c303fb69c05fdf4774698a"
23
+ "gitHead": "4e882720cfd1cdfc0f47a5bbd7b5a1f12d70ae1c"
24
24
  }
@@ -734,4 +734,43 @@ SPAN {
734
734
  assert.equal(getResultText(), expectedMessage);
735
735
  });
736
736
  }
737
+
738
+ it('Can execute code actions', async function () {
739
+ const editor = await openEditor(demoFileUri);
740
+ /** @type {import('@theia/monaco-editor-core/src/vs/editor/contrib/codeAction/browser/codeActionCommands').QuickFixController} */
741
+ const quickFixController = editor.getControl().getContribution('editor.contrib.quickFixController');
742
+ const isActionAvailable = () => {
743
+ const lightbulbVisibility = quickFixController['_ui'].rawValue?.['_lightBulbWidget'].rawValue?.['_domNode'].style.visibility;
744
+ return lightbulbVisibility !== undefined && lightbulbVisibility !== 'hidden';
745
+ }
746
+ assert.isFalse(isActionAvailable());
747
+ // import { DefinedInterface } from "./demo-definitions-file";
748
+ assert.strictEqual(editor.getControl().getModel().getLineContent(30), 'import { DefinedInterface } from "./demo-definitions-file";');
749
+ editor.getControl().revealLine(30);
750
+ editor.getControl().setSelection(new Selection(30, 1, 30, 60));
751
+ await waitForAnimation(() => isActionAvailable(), 5000, 'No code action available. (1)');
752
+ assert.isTrue(isActionAvailable());
753
+
754
+ await commands.executeCommand('editor.action.quickFix');
755
+ await waitForAnimation(() => Boolean(document.querySelector('.p-Widget.p-Menu')), 5000, 'No context menu appeared. (1)');
756
+ await animationFrame();
757
+
758
+ keybindings.dispatchKeyDown('ArrowDown');
759
+ keybindings.dispatchKeyDown('Enter');
760
+
761
+ await waitForAnimation(() => editor.getControl().getModel().getLineContent(30) === 'import * as demoDefinitionsFile from "./demo-definitions-file";', 5000, 'The namespace import did not take effect.');
762
+
763
+ editor.getControl().setSelection(new Selection(30, 1, 30, 64));
764
+ await waitForAnimation(() => isActionAvailable(), 5000, 'No code action available. (2)');
765
+
766
+ // Change it back: https://github.com/eclipse-theia/theia/issues/11059
767
+ await commands.executeCommand('editor.action.quickFix');
768
+ await waitForAnimation(() => Boolean(document.querySelector('.p-Widget.p-Menu')), 5000, 'No context menu appeared. (2)');
769
+ await animationFrame();
770
+
771
+ keybindings.dispatchKeyDown('ArrowDown');
772
+ keybindings.dispatchKeyDown('Enter');
773
+
774
+ await waitForAnimation(() => editor.getControl().getModel().getLineContent(30) === 'import { DefinedInterface } from "./demo-definitions-file";', 5000, 'The named import did not take effect.');
775
+ });
737
776
  });