Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public Object postProcessValue(Object input) throws Exception {
return list;
}

public static String getReturnValue(String s) {
return s.replace("\"", "'").replace("\n", "").replace("[]", "{}");

}

public class EditUserTypeListModel extends UserTypeListModel {
private final boolean allowToAddElements;
private final boolean allowToChangeElements;
Expand Down Expand Up @@ -80,8 +85,7 @@ public String getTemplateValue(TemplateModel arg0) throws TemplateModelException
+ definition.getName();
WfVariable templateComponentVariable = ViewUtil.createComponentVariable(variable, suffix, definition.getFormatNotNull(), null);
String inputComponentHtml = ViewUtil.getComponentInput(user, webHelper, templateComponentVariable);
return inputComponentHtml.replaceAll("\"", "'").replaceAll("\n", "").replace("[]", "{}");
return getReturnValue(inputComponentHtml);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package ru.runa.ftl.component;

import org.junit.Test;
import ru.runa.wf.web.ftl.component.EditUserTypeList;

import static org.junit.Assert.assertEquals;

public class EditUserTypeListTest {
@Test
public void getReturnValueTest1() {
String input = "Line1\nLine2\nLine3";
String output = "Line1Line2Line3";

assertEquals(output, EditUserTypeList.getReturnValue(input));
}

@Test
public void getReturnValueTest2() {
String input = "str \"str\" str";
String output = "str 'str' str";

assertEquals(output, EditUserTypeList.getReturnValue(input));
}

@Test
public void getReturnValueTest3() {
String input = "[str[]str[]str]";
String output = "[str{}str{}str]";

assertEquals(output, EditUserTypeList.getReturnValue(input));
}

@Test
public void getReturnValueTest4() {
String input = "line1\nLine2\"str\"\n[]";
String output = "line1Line2'str'{}";

assertEquals(output, EditUserTypeList.getReturnValue(input));
}
}