danwatford commented on code in PR #547:
URL: https://github.com/apache/ofbiz-framework/pull/547#discussion_r988854780
##########
framework/widget/src/test/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRendererTest.java:
##########
@@ -887,6 +887,55 @@ public void renderSortFieldUsesQueryString(@Mocked
ModelForm modelForm) throws I
"linkUrl", new FreemarkerRawString(linkFromQbeString)));
}
+ @Test
+ public void hyperlinkFieldMacroRenderedTitleNotTruncated(@Mocked
ModelFormField.HyperlinkField hyperlinkField) throws IOException {
+ final String description = "DESCRIPTION";
+ final String title = "TITLE";
+
+ new Expectations() {
+ {
+ hyperlinkField.getDescription(withNotNull()); result =
description;
+ hyperlinkField.getTarget(withNotNull()); result = "#";
+ request.getAttribute("title"); result = title;
+ }
+ };
+
+ macroFormRenderer.renderHyperlinkField(appendable, new HashMap<>(),
hyperlinkField);
+ assertAndGetMacroString("makeHyperlinkString",
ImmutableMap.of("description", description, "title", title));
+ }
+
+ @Test
+ public void hyperlinkFieldMacroRenderedTruncatedNoTitle(@Mocked
ModelFormField.HyperlinkField hyperlinkField) throws IOException {
+ final String description = "DESCRIPTION";
+
+ new Expectations() {
+ {
+ hyperlinkField.getDescription(withNotNull()); result =
description;
+ hyperlinkField.getTarget(withNotNull()); result = "#";
+ request.getAttribute("descriptionSize"); result = 5;
+ }
+ };
+
+ macroFormRenderer.renderHyperlinkField(appendable, new HashMap<>(),
hyperlinkField);
+ assertAndGetMacroString("makeHyperlinkString",
ImmutableMap.of("description", "DESCR…", "title", description));
+ }
+
+ @Test
+ public void hyperlinkFieldMacroRenderedTruncatedWithTitle(@Mocked
ModelFormField.HyperlinkField hyperlinkField) throws IOException {
+ final String description = "DESCRIPTION";
+
+ new Expectations() {
+ {
+ hyperlinkField.getDescription(withNotNull()); result =
description;
+ hyperlinkField.getTarget(withNotNull()); result = "#";
+ request.getAttribute("descriptionSize"); result = 5;
+ }
+ };
+
+ macroFormRenderer.renderHyperlinkField(appendable, new HashMap<>(),
hyperlinkField);
+ assertAndGetMacroString("makeHyperlinkString",
ImmutableMap.of("description", "DESCR…", "title", description));
Review Comment:
Ah I confused target and title!
Anyway, test hyperlinkFieldMacroRenderedTruncatedWithTitle seems to have the
same outcome as test hyperlinkFieldMacroRenderedTruncatedNoTitle. Was that the
intention?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]