1 5 package com.opensymphony.webwork.views.jsp.ui; 6 7 import com.opensymphony.webwork.TestAction; 8 import com.opensymphony.webwork.views.jsp.AbstractUITagTest; 9 10 import java.util.ArrayList ; 11 import java.util.Collection ; 12 13 14 20 public class CheckboxListTest extends AbstractUITagTest { 21 23 public void testMultiple() throws Exception { 24 TestAction testAction = (TestAction) action; 25 Collection collection = new ArrayList (2); 26 collection.add("hello"); 27 collection.add("foo"); 28 testAction.setCollection(collection); 29 testAction.setList(new String [][]{ 30 {"hello", "world"}, 31 {"foo", "bar"}, 32 {"cat", "dog"} 33 }); 34 35 CheckboxListTag tag = new CheckboxListTag(); 36 tag.setPageContext(pageContext); 37 tag.setLabel("mylabel"); 38 tag.setName("collection"); 39 tag.setList("list"); 40 tag.setListKey("top[0]"); 41 tag.setListValue("top[1]"); 42 43 tag.doStartTag(); 44 tag.doEndTag(); 45 46 verify(CheckboxListTag.class.getResource("CheckboxList-2.txt")); 47 } 48 49 public void testSimple() throws Exception { 50 TestAction testAction = (TestAction) action; 51 testAction.setFoo("hello"); 52 testAction.setList(new String [][]{ 53 {"hello", "world"}, 54 {"foo", "bar"} 55 }); 56 57 CheckboxListTag tag = new CheckboxListTag(); 58 tag.setPageContext(pageContext); 59 tag.setLabel("mylabel"); 60 tag.setName("foo"); 61 tag.setList("list"); 62 tag.setListKey("top[0]"); 63 tag.setListValue("top[1]"); 64 tag.setOnchange("alert('foo');"); 65 66 tag.doStartTag(); 67 tag.doEndTag(); 68 69 verify(CheckboxListTag.class.getResource("CheckboxList-1.txt")); 70 } 71 } 72 | Popular Tags |