")
- .append(hint)
+ .append("
")
+ .append(datePickerAttributes.hint())
.append("
");
- if (hasError) {
- html.append("
")
+ if (datePickerAttributes.hasError()) {
+ html.append("
")
.append("Error: ")
- .append(errorMessage)
+ .append(datePickerAttributes.errorMessage())
.append("
");
}
html.append("
")
diff --git a/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/main/java/uk/gov/laa/ccms/springboot/dialect/MojCustomDialect.java b/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/main/java/uk/gov/laa/ccms/springboot/dialect/MojCustomDialect.java
index 039129a..e139339 100644
--- a/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/main/java/uk/gov/laa/ccms/springboot/dialect/MojCustomDialect.java
+++ b/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/main/java/uk/gov/laa/ccms/springboot/dialect/MojCustomDialect.java
@@ -3,11 +3,15 @@
import java.util.Set;
import org.thymeleaf.dialect.AbstractProcessorDialect;
import org.thymeleaf.processor.IProcessor;
+import org.thymeleaf.standard.StandardDialect;
+/**
+ * Develops a custom MoJ dialect.
+ */
public class MojCustomDialect extends AbstractProcessorDialect {
public MojCustomDialect() {
- super("MOJ Custom Dialect", "moj", 1000);
+ super("MOJ Custom Dialect", "moj", StandardDialect.PROCESSOR_PRECEDENCE);
}
@Override
diff --git a/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/test/java/uk/gov/laa/ccms/springboot/dialect/MoJDatePickerElementTagProcessorTest.java b/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/test/java/uk/gov/laa/ccms/springboot/dialect/MoJDatePickerElementTagProcessorTest.java
index 09340b1..192e816 100644
--- a/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/test/java/uk/gov/laa/ccms/springboot/dialect/MoJDatePickerElementTagProcessorTest.java
+++ b/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/test/java/uk/gov/laa/ccms/springboot/dialect/MoJDatePickerElementTagProcessorTest.java
@@ -1,7 +1,36 @@
package uk.gov.laa.ccms.springboot.dialect;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.assertj.core.api.Assertions.assertThat;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.thymeleaf.context.Context;
+import org.thymeleaf.spring6.SpringTemplateEngine;
+
+@SpringBootTest(classes = ThymeleafTestConfig.class)
class MoJDatePickerElementTagProcessorTest {
+ @Autowired
+ private SpringTemplateEngine templateEngine;
+
+ @Test
+ void shouldRenderGovukButton() {
+
+ Context context = new Context();
+ String renderedHtml = templateEngine.process("test-datepicker", context);
+ assertThat(renderedHtml)
+ .contains(
+ "
");
+
+ }
+
}
\ No newline at end of file
diff --git a/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/test/java/uk/gov/laa/ccms/springboot/dialect/ThymeleafTestConfig.java b/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/test/java/uk/gov/laa/ccms/springboot/dialect/ThymeleafTestConfig.java
index dfe15d3..3f9107d 100644
--- a/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/test/java/uk/gov/laa/ccms/springboot/dialect/ThymeleafTestConfig.java
+++ b/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/test/java/uk/gov/laa/ccms/springboot/dialect/ThymeleafTestConfig.java
@@ -13,6 +13,7 @@ public class ThymeleafTestConfig {
public SpringTemplateEngine testTemplateEngine() {
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.addDialect(new GovUkDialect());
+ templateEngine.addDialect(new MojCustomDialect());
templateEngine.addTemplateResolver(templateResolver());
return templateEngine;
}
diff --git a/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/test/resources/templates/test-datepicker.html b/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/test/resources/templates/test-datepicker.html
new file mode 100644
index 0000000..43dd98e
--- /dev/null
+++ b/laa-ccms-spring-boot-starters/laa-ccms-spring-boot-starter-govuk-dialect/src/test/resources/templates/test-datepicker.html
@@ -0,0 +1,20 @@
+
+
+
+
Datepicker Test
+
+
+
+
+
+
+
+
\ No newline at end of file