use of org.thymeleaf.dialect.IProcessorDialect in project thymeleaf-tests by thymeleaf.
the class ElementProcessorIteratorTest method testProcessorIteration07.
@Test
public void testProcessorIteration07() {
final IProcessorDialect dialect = ProcessorAggregationTestDialect.buildHTMLDialect("standard", "th", "N-ELEMENT-10-null-src,N-ELEMENT-5-null-src,N-ELEMENT-2-null-one");
final TagObtentionTemplateHandler handler = computeHtmlTag("<a th:src='hello'>", dialect);
final ElementProcessorIterator iterator = handler.iter;
final OpenElementTag tag = handler.tag;
tag.getAttributes().removeAttribute("th:src");
tag.getAttributes().setAttribute("th:one", "somevalue");
Assert.assertEquals("N-ELEMENT-2-null-{th:one,data-th-one}", iterator.next(tag).toString());
Assert.assertNull(iterator.next(tag));
}
use of org.thymeleaf.dialect.IProcessorDialect in project thymeleaf-tests by thymeleaf.
the class ElementProcessorIteratorTest method testProcessorIteration11.
@Test
public void testProcessorIteration11() {
final IProcessorDialect dialect = ProcessorAggregationTestDialect.buildHTMLDialect("standard", "th", "N-ELEMENT-10-null-src,N-ELEMENT-5-null-src,N-ELEMENT-2-null-one");
final TagObtentionTemplateHandler handler = computeHtmlTag("<div class='one'><a th:src='hello'>", dialect);
final ElementProcessorIterator iterator = handler.iter;
final OpenElementTag tag = handler.tag;
Assert.assertEquals("N-ELEMENT-5-null-{th:src,data-th-src}", iterator.next(tag).toString());
tag.getAttributes().setAttribute("th:one", "somevalue");
Assert.assertEquals("N-ELEMENT-2-null-{th:one,data-th-one}", iterator.next(tag).toString());
tag.getAttributes().removeAttribute("th:src");
Assert.assertNull(iterator.next(tag));
}
use of org.thymeleaf.dialect.IProcessorDialect in project thymeleaf-tests by thymeleaf.
the class ElementProcessorIteratorTest method testProcessorIteration03.
@Test
public void testProcessorIteration03() {
final IProcessorDialect dialect = ProcessorAggregationTestDialect.buildHTMLDialect("standard", "th", "N-ELEMENT-10-null-src,N-ELEMENT-5-null-src,N-ELEMENT-7-null-one");
final TagObtentionTemplateHandler handler = computeHtmlTag("<a th:src='hello'>", dialect);
final ElementProcessorIterator iterator = handler.iter;
final OpenElementTag tag = handler.tag;
Assert.assertEquals("N-ELEMENT-5-null-{th:src,data-th-src}", iterator.next(tag).toString());
tag.getAttributes().setAttribute("th:one", "somevalue");
Assert.assertEquals("N-ELEMENT-7-null-{th:one,data-th-one}", iterator.next(tag).toString());
Assert.assertEquals("N-ELEMENT-10-null-{th:src,data-th-src}", iterator.next(tag).toString());
Assert.assertNull(iterator.next(tag));
}
use of org.thymeleaf.dialect.IProcessorDialect in project thymeleaf-tests by thymeleaf.
the class ElementProcessorIteratorTest method testProcessorIteration10.
@Test
public void testProcessorIteration10() {
// This one checks that iteration also works OK for tags using a non-standard implementation
final IProcessorDialect dialect = ProcessorAggregationTestDialect.buildHTMLDialect("standard", "th", "N-ELEMENT-10-null-src,N-ELEMENT-5-null-src,N-ELEMENT-2-null-one");
final TagObtentionTemplateHandler handler = computeHtmlTag("<a th:src='hello'>", dialect);
final ElementProcessorIterator iterator = handler.iter;
final OpenElementTag tag = handler.tag;
Assert.assertEquals("N-ELEMENT-5-null-{th:src,data-th-src}", iterator.next(tag).toString());
tag.getAttributes().setAttribute("th:one", "somevalue");
Assert.assertEquals("N-ELEMENT-2-null-{th:one,data-th-one}", iterator.next(tag).toString());
tag.getAttributes().removeAttribute("th:src");
Assert.assertNull(iterator.next(tag));
}
use of org.thymeleaf.dialect.IProcessorDialect in project thymeleaf-tests by thymeleaf.
the class ElementProcessorIteratorTest method testProcessorIteration14.
@Test
public void testProcessorIteration14() {
// This one checks that iteration also works OK for tags using a non-standard implementation
final IProcessorDialect dialect = ProcessorAggregationTestDialect.buildHTMLDialect("standard", "th", "N-ELEMENT-10-null-src,N-ELEMENT-5-*a-src,N-ELEMENT-2-null-one");
final TagObtentionTemplateHandler handler = computeHtmlTag("<div class='one'><p th:src='uuuh'><a th:src='hello'>", dialect);
final ElementProcessorIterator iterator = handler.iter;
final OpenElementTag tag = handler.tag;
Assert.assertEquals("N-ELEMENT-5-{a}-{th:src,data-th-src}", iterator.next(tag).toString());
tag.getAttributes().setAttribute("th:one", "somevalue");
Assert.assertEquals("N-ELEMENT-2-null-{th:one,data-th-one}", iterator.next(tag).toString());
tag.getAttributes().removeAttribute("th:src");
Assert.assertNull(iterator.next(tag));
}
Aggregations