use of org.thymeleaf.spring6.ISpringWebFluxTemplateEngine in project spring-boot by spring-projects.
the class ThymeleafReactiveAutoConfigurationTests method useDataDialect.
@Test
void useDataDialect() {
this.contextRunner.run((context) -> {
ISpringWebFluxTemplateEngine engine = context.getBean(ISpringWebFluxTemplateEngine.class);
Context attrs = new Context(Locale.UK, Collections.singletonMap("foo", "bar"));
String result = engine.process("data-dialect", attrs).trim();
assertThat(result).isEqualTo("<html><body data-foo=\"bar\"></body></html>");
});
}
use of org.thymeleaf.spring6.ISpringWebFluxTemplateEngine in project spring-boot by spring-projects.
the class ThymeleafReactiveAutoConfigurationTests method renderTemplate.
@Test
void renderTemplate() {
this.contextRunner.run((context) -> {
ISpringWebFluxTemplateEngine engine = context.getBean(ISpringWebFluxTemplateEngine.class);
Context attrs = new Context(Locale.UK, Collections.singletonMap("foo", "bar"));
String result = engine.process("home", attrs).trim();
assertThat(result).isEqualTo("<html><body>bar</body></html>");
});
}
use of org.thymeleaf.spring6.ISpringWebFluxTemplateEngine in project spring-boot by spring-projects.
the class ThymeleafReactiveAutoConfigurationTests method useSecurityDialect.
@Test
void useSecurityDialect() {
this.contextRunner.run((context) -> {
ISpringWebFluxTemplateEngine engine = context.getBean(ISpringWebFluxTemplateEngine.class);
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/test").build());
exchange.getAttributes().put(SpringSecurityContextUtils.SECURITY_CONTEXT_MODEL_ATTRIBUTE_NAME, new SecurityContextImpl(new TestingAuthenticationToken("alice", "admin")));
WebContext attrs = new WebContext(SpringWebFluxWebApplication.buildApplication(null).buildExchange(exchange, Locale.US, MediaType.TEXT_HTML, StandardCharsets.UTF_8));
String result = engine.process("security-dialect", attrs);
assertThat(result).isEqualTo("<html><body><div>alice</div></body></html>" + System.lineSeparator());
});
}
use of org.thymeleaf.spring6.ISpringWebFluxTemplateEngine in project spring-boot by spring-projects.
the class ThymeleafReactiveAutoConfigurationTests method useJava8TimeDialect.
@Test
void useJava8TimeDialect() {
this.contextRunner.run((context) -> {
ISpringWebFluxTemplateEngine engine = context.getBean(ISpringWebFluxTemplateEngine.class);
Context attrs = new Context(Locale.UK);
String result = engine.process("java8time-dialect", attrs).trim();
assertThat(result).isEqualTo("<html><body>2015-11-24</body></html>");
});
}
Aggregations