Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qute: do not ignore a user-provided template variant #13116

Merged
merged 1 commit into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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