Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: Mickael Istria <mistria@redhat.com>
  • Loading branch information
mickaelistria committed Mar 18, 2020
1 parent a951dc1 commit e62e83d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
3 changes: 2 additions & 1 deletion org.eclipse.wildwebdeveloper.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ Require-Bundle: org.eclipse.wildwebdeveloper;bundle-version="0.5.0",
org.eclipse.lsp4j;bundle-version="0.9.0",
org.eclipse.lsp4j.jsonrpc,
org.eclipse.debug.ui,
org.eclipse.core.filesystem
org.eclipse.core.filesystem,
org.eclipse.ui.editors
Import-Package: org.eclipse.ui.editors.text
2 changes: 1 addition & 1 deletion org.eclipse.wildwebdeveloper.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<version>0.5.0-SNAPSHOT</version>
</parent>
<packaging>eclipse-test-plugin</packaging>
<version>0.4.2-SNAPSHOT</version>
<version>0.4.3-SNAPSHOT</version>
<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.lsp4e.operations.completion.LSContentAssistProcessor;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.tests.harness.util.DisplayHelper;
import org.eclipse.ui.texteditor.ITextEditor;
import org.junit.Rule;
import org.junit.Test;

Expand All @@ -53,7 +55,7 @@ public void testAngular() throws Exception {
IFolder appFolder = project.getFolder("src").getFolder("app");

IFile appComponentFile = appFolder.getFile("app.component.ts");
ITextEditor editor = (ITextEditor) IDE
TextEditor editor = (TextEditor) IDE
.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), appComponentFile);
DisplayHelper.sleep(4000); // Give time for LS to initialize enough before making edit and sending a didChange
// make an edit
Expand All @@ -73,10 +75,11 @@ protected boolean condition() {
}.waitForCondition(PlatformUI.getWorkbench().getDisplay(), 50000));
editor.close(false);

editor = (ITextEditor) IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), appFolder.getFile("app.componentWithHtml.ts"));
editor = (TextEditor) IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), appFolder.getFile("app.componentWithHtml.ts"));
DisplayHelper.sleep(4000); // Give time for LS to initialize enough before making edit and sending a didChange
IFile appComponentHTML = appFolder.getFile("app.componentWithHtml.html");
editor = (ITextEditor) IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), appComponentHTML);
editor = (TextEditor) IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), appComponentHTML);
document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
assertTrue("No error found on erroneous HTML component file", new DisplayHelper() {
@Override protected boolean condition() {
IMarker[] markers;
Expand All @@ -89,6 +92,11 @@ protected boolean condition() {
}
}
}.waitForCondition(editor.getSite().getShell().getDisplay(), 30000));
// test completion
LSContentAssistProcessor contentAssistProcessor = new LSContentAssistProcessor();
ICompletionProposal[] proposals = contentAssistProcessor.computeCompletionProposals(Utils.getViewer(editor), document.get().indexOf("}}"));
proposals[0].apply(document);
assertEquals("Incorrect completion insertion", "<h1>{{title}}</h1>", document.get());
}

public static String getNpmLocation() {
Expand Down

0 comments on commit e62e83d

Please sign in to comment.