Skip to content

Commit

Permalink
Merge pull request #13116 from mkouba/issue-13113
Browse files Browse the repository at this point in the history
Qute: do not ignore a user-provided template variant
  • Loading branch information
gsmet authored Nov 4, 2020
2 parents 106cdaa + e47a50e commit 48d91ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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

import java.util.Locale;

import javax.inject.Inject;

import org.jboss.shrinkwrap.api.ShrinkWrap;
Expand All @@ -14,6 +16,7 @@
import io.quarkus.qute.RawString;
import io.quarkus.qute.Template;
import io.quarkus.qute.TemplateData;
import io.quarkus.qute.Variant;
import io.quarkus.test.QuarkusUnitTest;

public class EscapingTest {
Expand Down Expand Up @@ -61,6 +64,13 @@ public void testValidation() {
engine.getTemplate("validation").data("text", "<div>").render());
}

@Test
public void testEngineParse() {
assertEquals("&lt;div&gt; <div>",
engine.parse("{text} {text.raw}",
new Variant(Locale.ENGLISH, "text/html", "UTF-8")).data("text", "<div>").render());
}

@TemplateData
public static class Item {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static EngineBuilder builder() {
* @return the template
*/
default Template parse(String content) {
return parse(content, null);
return parse(content, null, null);
}

/**
Expand All @@ -40,7 +40,7 @@ default Template parse(String content) {
* @return the template
*/
default Template parse(String content, Variant variant) {
return parse(content, null, null);
return parse(content, variant, null);
}

/**
Expand Down

0 comments on commit 48d91ff

Please sign in to comment.