Skip to content

Commit

Permalink
Fixed data-pattern-error-message field erased when the <input> tag is…
Browse files Browse the repository at this point in the history
… used in MessageML format
  • Loading branch information
thibauult committed Jan 11, 2022
1 parent aae673c commit ea7311b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ default Map<String, String> getRegexAttrForPresentationML(){
presentationAttrs.put(PRESENTATIONML_PATTERN_ERROR_MESSAGE_ATTR, getAttribute(PATTERN_ERROR_MESSAGE_ATTR));
}

if (getAttribute(PRESENTATIONML_PATTERN_ERROR_MESSAGE_ATTR) != null) {
presentationAttrs.put(PRESENTATIONML_PATTERN_ERROR_MESSAGE_ATTR, getAttribute(PRESENTATIONML_PATTERN_ERROR_MESSAGE_ATTR));
}

return presentationAttrs;
}

Expand All @@ -101,7 +105,7 @@ default Map<String, String> getRegexAttrForPresentationML(){
*/
default Map<String, String> getOtherAttributes(){
Map<String, String> presentationAttrs = new LinkedHashMap<>(getAttributes());
ALL_REGEX_ATTRS.stream().forEach(attr -> presentationAttrs.remove(attr));
ALL_REGEX_ATTRS.forEach(presentationAttrs::remove);
return presentationAttrs;
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/examples/form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

<h5>Text Fields</h5>
<text-field name="name" placeholder="Input your name..." required="true"/>
<text-field name="age" placeholder="Text field with a tool tip" title="What's your age?"/>
<text-field name="age" placeholder="Text field with a tool tip" title="What's your age?" pattern="(^[0-9,]+$|^$)" pattern-error-message="Please input numbers."/>

<br/>

Expand Down

0 comments on commit ea7311b

Please sign in to comment.