Skip to content

Commit

Permalink
Merge pull request #198 from sdutry/formatting-changes
Browse files Browse the repository at this point in the history
add tests to UIBean class
  • Loading branch information
sdutry authored Jan 5, 2018
2 parents f803ddb + 08c058e commit a66f92c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions core/src/test/java/org/apache/struts2/components/UIBeanTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,30 @@ public void testValueParameterEvaluation() {

assertEquals(value, txtFld.getParameters().get("nameValue"));
}

public void testSetClass() {
String cssClass = "insertCssClassHere";
ValueStack stack = ActionContext.getContext().getValueStack();
MockHttpServletRequest req = new MockHttpServletRequest();
MockHttpServletResponse res = new MockHttpServletResponse();

TextField txtFld = new TextField(stack, req, res);
txtFld.setClass(cssClass);
txtFld.evaluateParams();

assertEquals(cssClass, txtFld.getParameters().get("cssClass"));
}

public void testSetStyle() {
String cssStyle = "insertCssStyleHere";
ValueStack stack = ActionContext.getContext().getValueStack();
MockHttpServletRequest req = new MockHttpServletRequest();
MockHttpServletResponse res = new MockHttpServletResponse();

TextField txtFld = new TextField(stack, req, res);
txtFld.setStyle(cssStyle);
txtFld.evaluateParams();

assertEquals(cssStyle, txtFld.getParameters().get("cssStyle"));
}
}

0 comments on commit a66f92c

Please sign in to comment.