assertXpathExists("//execute-javascript/content/script", rendering);
assertTrue(rendering.indexOf("new Effect.Highlight(\"ErrorCode1\",{\"startcolor\":\"#FF0A0A\"});") != -1);
}
public void testValidateWithErrorsPart2() throws Exception {
AjaxResponse response = null;
String rendering = null;
DefaultValidationHandler handler = new DefaultValidationHandler();
handler.setMessageSource(new DelegatingMessageSource());
handler.setErrorRenderingCallback(new DefaultErrorRenderingCallback() {
public Component getErrorComponent(AjaxSubmitEvent event, ObjectError error, MessageSource messageSource, Locale locale) {
return new TaggedText(messageSource.getMessage(error.getCode(), null, error.getDefaultMessage() + " for event : " + event.getEventId(), locale), TaggedText.Tag.SPAN);
}
});
// Errors:
this.submitEvent.setValidationErrors(this.errors);
response = handler.validate(submitEvent);
rendering = response.render();
System.out.println(rendering);
assertXpathEvaluatesTo("Default Message 1 for event : submitEvent", "//append-as-children/content/span", rendering);
assertXpathEvaluatesTo("wildcard", "//append-as-children/context/matcher/@matchMode", rendering);
assertXpathExists("//execute-javascript/content/script", rendering);