use of org.apache.tapestry5.OptionModel in project tapestry-5 by apache.
the class EnumSelectModelTest method checkOption.
private void checkOption(final List<OptionModel> options, final int i, final String label, final Stooge value) {
OptionModel model = options.get(i);
assertEquals(model.getLabel(), label);
assertFalse(model.isDisabled());
assertSame(model.getValue(), value);
assertNull(model.getAttributes());
}
use of org.apache.tapestry5.OptionModel in project tapestry-5 by apache.
the class LocalizationSetterImplTest method get_locale_model.
@Test
public void get_locale_model() {
LocalizationSetter setter = new LocalizationSetterImpl(null, null, null, "en,fr");
SelectModel model = setter.getSupportedLocalesModel();
assertNull(model.getOptionGroups());
List<OptionModel> options = model.getOptions();
assertEquals(options.size(), 2);
assertEquals(options.get(0).getLabel(), "English");
// Note that the label is localized to the underlying locale, not the default locale.
// That's why its "français" (i.e., as a French speaker would say it), not "French"
// (like an English speaker).
assertEquals(options.get(1).getLabel(), "fran\u00e7ais");
assertEquals(options.get(0).getValue(), Locale.ENGLISH);
assertEquals(options.get(1).getValue(), Locale.FRENCH);
}
use of org.apache.tapestry5.OptionModel in project tapestry-5 by apache.
the class OptionGroupModelImplTest method strings_contructor_builds_map.
@Test
public void strings_contructor_builds_map() {
List<OptionModel> options = Collections.emptyList();
OptionGroupModel group = new OptionGroupModelImpl("Label", true, options, "fred", "flintstone", "barney", "rubble");
Map<String, String> attributes = group.getAttributes();
assertEquals(attributes.size(), 2);
assertEquals(attributes.get("fred"), "flintstone");
assertEquals(attributes.get("barney"), "rubble");
}
use of org.apache.tapestry5.OptionModel in project tapestry-5 by apache.
the class OptionGroupModelImplTest method map_contructor_retains_map.
@Test
public void map_contructor_retains_map() {
List<OptionModel> options = Collections.emptyList();
Map<String, String> attributes = Collections.emptyMap();
OptionGroupModel group = new OptionGroupModelImpl("Label", true, options, attributes);
assertSame(group.getAttributes(), attributes);
}
use of org.apache.tapestry5.OptionModel in project tapestry-5 by apache.
the class OptionGroupModelImplTest method basics.
@Test
public void basics() {
List<OptionModel> options = Collections.emptyList();
OptionGroupModel group = new OptionGroupModelImpl("Label", true, options);
assertEquals(group.toString(), "OptionGroupModel[Label]");
assertTrue(group.isDisabled());
assertNull(group.getAttributes());
assertSame(group.getOptions(), options);
}
Aggregations