@Test public void testAction() { Address address = new Address(); address.setCountry("US"); Edit action = new Edit(); action.user = new User(); action.user.setAddress("work", address); ais.setCurrent(new DefaultActionInvocation(action, "/checkbox-list", null, null)); run( checkboxList, mapNV( "name", "user.addresses['work'].country", "class", "css-class", "items", lmap("US", "United States", "DE", "Germany")), null, "<input type=\"hidden\" name=\"user.addresses['work'].country@param\" value=\"param-value\"/>\n" + "<div class=\"checkbox-list input control\">\n" + "<div class=\"checkbox-list-label input-label control-label\"><label for=\"user_addresses['work']_country\" class=\"label\">Country</label></div>\n" + "<div class=\"checkbox-list-item-container input-container control-container\">\n" + "<input type=\"checkbox\" checked=\"checked\" value=\"US\" class=\"css-class\" name=\"user.addresses['work'].country\"/><span class=\"checkbox-text\">United States</span>\n" + "</div>\n" + "<div class=\"checkbox-list-item-container input-container control-container\">\n" + "<input type=\"checkbox\" value=\"DE\" class=\"css-class\" name=\"user.addresses['work'].country\"/><span class=\"checkbox-text\">Germany</span>\n" + "</div>\n" + "</div>\n"); }
@Test public void testActionLess() { ais.setCurrent(new DefaultActionInvocation(null, "/checkbox-list", null, null)); run( checkboxList, mapNV( "name", "test", "class", "css-class", "bundle", "/checkbox-list-bundle", "items", asList("one", "two", "three")), null, "<input type=\"hidden\" name=\"test@param\" value=\"param-value\"/>\n" + "<div class=\"checkbox-list input control\">\n" + "<div class=\"checkbox-list-label input-label control-label\"><label for=\"test\" class=\"label\">Test</label></div>\n" + "<div class=\"checkbox-list-item-container input-container control-container\">\n" + "<input type=\"checkbox\" value=\"one\" class=\"css-class\" name=\"test\"/><span class=\"checkbox-text\">one</span>\n" + "</div>\n" + "<div class=\"checkbox-list-item-container input-container control-container\">\n" + "<input type=\"checkbox\" value=\"two\" class=\"css-class\" name=\"test\"/><span class=\"checkbox-text\">two</span>\n" + "</div>\n" + "<div class=\"checkbox-list-item-container input-container control-container\">\n" + "<input type=\"checkbox\" value=\"three\" class=\"css-class\" name=\"test\"/><span class=\"checkbox-text\">three</span>\n" + "</div>\n" + "</div>\n"); }