Skip to content

Commit

Permalink
[tests] Fix for 'TestVue.testVuetemplate'
Browse files Browse the repository at this point in the history
```
Failures:
  TestVue.testVueTemplate:178 Incorrect completion insertion ==> expected: <<template>
  <div>
    <only-start></only-start>
  </div>
</template>
<script>
export default {
  name: 'HelloWorld',
  props: {
    msg: String
  }
}
</script>
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>> but was: <<template>
  <div>
    <only-start><style
  </div>
</template>
<script>
export default {
  name: 'HelloWorld',
  props: {
    msg: String
  }
}
</script>
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>>
```
  • Loading branch information
vrubezhny committed Aug 29, 2024
1 parent e2a4d87 commit 72eee34
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion org.eclipse.wildwebdeveloper.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tests for WildWebDeveloper
Bundle-SymbolicName: org.eclipse.wildwebdeveloper.tests;singleton:=true
Bundle-Version: 1.0.14.qualifier
Bundle-Version: 1.0.15.qualifier
Bundle-Vendor: Eclipse Wild Web Developer
Automatic-Module-Name: org.eclipse.wildwebdeveloper.tests
Bundle-RequiredExecutionEnvironment: JavaSE-21
Expand Down
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>1.0.0-SNAPSHOT</version>
</parent>
<packaging>eclipse-test-plugin</packaging>
<version>1.0.14-SNAPSHOT</version>
<version>1.0.15-SNAPSHOT</version>
<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package org.eclipse.wildwebdeveloper.tests;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.BufferedReader;
Expand Down Expand Up @@ -142,7 +143,8 @@ void testVueTemplate() throws Exception {
editor = (TextEditor) IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(),
appComponentHTML);
IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
String tag = "<only-start>";
String tagName = "only-start";
String tag = '<' + tagName + '>';
document.set(document.get().replace(tag, tag + "<"));
assertTrue(new DisplayHelper() {
@Override
Expand Down Expand Up @@ -174,7 +176,13 @@ protected boolean condition() {
int pos = document.get().indexOf(tag) + tag.length();
ICompletionProposal[] proposals = contentAssistProcessor.computeCompletionProposals(Utils.getViewer(editor),
pos + 1);
proposals[0].apply(document);

// Find closing tag proposal
ICompletionProposal closingTagProposal = Arrays.stream(proposals)
.filter(p -> p.getDisplayString().equals('/' + tagName)).findFirst().orElse(null);
assertNotNull(closingTagProposal, "Closing tag proposal not found for '" + tag + "'");

closingTagProposal.apply(document);
assertEquals(new String(componentFolder.getFile("HelloWorldCorrect.vue").getContents().readAllBytes()).trim(),
document.get().trim(), "Incorrect completion insertion");

Expand Down

0 comments on commit 72eee34

Please sign in to comment.