Example #1
0
  public void testSimpleIntegerWithValueWorkaround() throws Exception {
    TestAction testAction = (TestAction) action;

    IdName hello = new IdName(new Integer(1), "hello");
    IdName world = new IdName(new Integer(2), "world");
    List list2 = new ArrayList();
    list2.add(hello);
    list2.add(world);
    testAction.setList2(list2);

    testAction.setFooInt(new Integer(1));

    SelectTag tag = new SelectTag();
    tag.setPageContext(pageContext);
    tag.setEmptyOption("true");
    tag.setLabel("mylabel");
    tag.setName("fooInt");
    tag.setList("list2");
    tag.setListKey("id");
    tag.setListValue("name");
    tag.setValue("fooInt.toString()");

    // header stuff
    tag.setHeaderKey("headerKey");
    tag.setHeaderValue("headerValue");

    // empty option
    tag.setEmptyOption("true");

    tag.doStartTag();
    tag.doEndTag();

    verify(SelectTag.class.getResource("Select-11.txt"));
  }
Example #2
0
  public void testExtended() throws Exception {
    TestAction testAction = (TestAction) action;
    testAction.setFoo("hello");
    testAction.setList(
        new String[][] {
          {"hello", "world"},
          {"foo", "bar"}
        });

    SelectTag tag = new SelectTag();
    tag.setPageContext(pageContext);
    tag.setEmptyOption("true");
    tag.setLabel("mylabel");
    tag.setName("foo");
    tag.setList("list");
    tag.setListKey("top[0]");
    tag.setListValue("%{top[0] + ' - ' + top[1]}");

    // header stuff
    tag.setHeaderKey("headerKey");
    tag.setHeaderValue("%{foo + ': headerValue'}");

    // empty option
    tag.setEmptyOption("true");

    tag.doStartTag();
    tag.doEndTag();

    verify(SelectTag.class.getResource("Select-7.txt"));
  }
Example #3
0
  public void testSimpleWithNulls() throws Exception {
    TestAction testAction = (TestAction) action;
    testAction.setFoo("hello");
    testAction.setList(
        new String[][] {
          {"hello", null},
          {null, "bar"}
        });

    SelectTag tag = new SelectTag();
    tag.setPageContext(pageContext);
    tag.setEmptyOption("true");
    tag.setLabel("mylabel");
    tag.setName("foo");
    tag.setList("list");
    tag.setListKey("top[0]");
    tag.setListValue("top[1]");

    // header stuff
    tag.setHeaderKey("headerKey");
    tag.setHeaderValue("headerValue");

    // empty option
    tag.setEmptyOption("true");

    tag.doStartTag();
    tag.doEndTag();

    verify(SelectTag.class.getResource("Select-9.txt"));
  }
Example #4
0
  public void testMultipleOff() throws Exception {
    SelectTag tag = new SelectTag();
    tag.setPageContext(pageContext);
    tag.setLabel("media2");
    tag.setId("myId");
    tag.setEmptyOption("true");
    tag.setName("myName");
    tag.setMultiple("false");
    tag.setList("{'aaa','bbb'}");

    tag.doStartTag();
    tag.doEndTag();

    verify(SelectTag.class.getResource("Select-6.txt"));
  }