Package javango.forms.widgets

Examples of javango.forms.widgets.Widget.render()


  }

  public void testHtmlNull() throws Exception {
    Widget w = injector.getInstance(PercentInputWidget.class);
    Double value = null;
    String output = w.render("field", value, new LinkedHashMap<String, Object>());
    String html = "<input type=\"text\" name=\"field\" />";
    assertEquals(html, output);
   
    assertEquals("", w.asText(value));   
  }
View Full Code Here


  private Log log = LogFactory.getLog(TextAreaWidgetTest.class);
 
  public void testEmptyValueHtml() {
    Widget w = new TextAreaWidget();
    String value = "";
    String output = w.render("field", value, new HashMap<String, Object>());
    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\"></textarea>";
    assertEquals(html, output);
  }

  public void testNullValueHtml() {
View Full Code Here

  }

  public void testNullValueHtml() {
    Widget w = new TextAreaWidget();
    String value = null;
    String output = w.render("field", value, new HashMap<String, Object>());
    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\"></textarea>";
    assertEquals(html, output);
  }
 
  public void testEmptyArrayValueHtml() {
View Full Code Here

  }
 
  public void testEmptyArrayValueHtml() {
    Widget w = new TextAreaWidget();
    String[] value = new String[]{};
    String output = w.render("field", value, new HashMap<String, Object>());
    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\"></textarea>";
    assertEquals(html, output);
  }

  public void testStringHtml() {
View Full Code Here

  }

  public void testStringHtml() {
    Widget w = new TextAreaWidget();
    String value = "hello";
    String output = w.render("field", value, new HashMap<String, Object>());
    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\">hello</textarea>";
    assertEquals(html, output);
  }
 
  public void testStringArrayHtml() {
View Full Code Here

  }
 
  public void testStringArrayHtml() {
    Widget w = new TextAreaWidget();
    String[] value = new String[]{"hello"};
    String output = w.render("field", value, new HashMap<String, Object>());
    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\">hello</textarea>";
    assertEquals(html, output);
  }

  public void testIdAttrHtml() {
View Full Code Here

  public void testIdAttrHtml() {
    Widget w = new TextAreaWidget();
    String[] value = new String[]{"hello"};
    Map<String, Object> attrs = new HashMap<String, Object>();
    attrs.put("id", "id_%s");
    String output = w.render("field", value, attrs);
    String html = "<textarea id=\"id_field\" name=\"field\" rows=\"10\" cols=\"40\">hello</textarea>";
    assertEquals(html, output);
  }
 
  public void testWithRowsColsAttrs() {
View Full Code Here

    attrs.put("id", "id_%s");
   
    attrs.put("rows", "5");
    attrs.put("cols", "20");
   
    String output = w.render("field", value, attrs);
    String html = "<textarea id=\"id_field\" rows=\"5\" cols=\"20\" name=\"field\">hello</textarea>";
    assertEquals(html, output);
  }
}
View Full Code Here

  private Log log = LogFactory.getLog(DecimalInputWidgetTest.class);
 
  public void testEmptyValueHtml() {
    Widget w = new DecimalInputWidget();
    Double value = null;
    String output = w.render("field", value, new LinkedHashMap<String, Object>());
    String html = "<input type=\"text\" name=\"field\" />";
    assertEquals(html, output);
   
    assertEquals("", w.asText(value));
  }
View Full Code Here

  }
 
  public void testEmptyArrayValueHtml() {
    Widget w = new DecimalInputWidget();
    Double[] value = new Double[]{};
    String output = w.render("field", value, new LinkedHashMap<String, Object>());
    String html = "<input type=\"text\" name=\"field\" />";
    assertEquals(html, output);
   
    assertEquals("", w.asText(value));
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.