@Override public IsCheckBox newCheckBox() { return new StubCheckBox(); }
public boolean isChecked() { return TRUE.equals(getValue()); }
public void uncheck() { if (value == null || !value.booleanValue()) { throw new RuntimeException(name + " is not checked"); } click(); }
@Test public void testContainsBound() { Binder b = new Binder(); StubCheckBox c = new StubCheckBox(); BooleanProperty s = p.contains("s"); b.bind(s).to(c); assertThat(c.getValue(), is(false)); }
@Test public void testContainsBoundWhenUiChanges() { Binder b = new Binder(); StubCheckBox c = new StubCheckBox(); BooleanProperty s = p.contains("s"); b.bind(s).to(c); c.check(); assertThat(p.get(), contains("s")); c.uncheck(); assertThat(p.get().isEmpty(), is(true)); }
@Test public void checkingSetsTheLabel() { v.box().check(); assertThat(v.label().getText(), is("Checked!")); }
public void set(final Boolean value) { setValue(value, true); }
@Test public void testContainsBoundWhenAlreadyTrue() { Binder b = new Binder(); StubCheckBox c = new StubCheckBox(); p.add("s"); BooleanProperty s = p.contains("s"); b.bind(s).to(c); assertThat(c.getValue(), is(true)); }
@Override public void click() { final Boolean newValue = (value == null) ? true : !value; setValue(newValue, true); super.click(); }
@Test public void testContainsBoundWhenModelChanges() { Binder b = new Binder(); StubCheckBox c = new StubCheckBox(); BooleanProperty s = p.contains("s"); b.bind(s).to(c); p.add("s"); assertThat(c.getValue(), is(true)); }
@Test public void booleanToCheckAndView() { final StubCheckBox c1 = new StubCheckBox(); final StubWidget v1 = new StubWidget(); final BooleanProperty b = booleanProperty("b", false); binder.bind(b).to(c1, v1); assertThat(v1, is(hidden())); b.set(true); assertThat(v1, is(shown())); }
public void check() { if (value != null && value.booleanValue()) { throw new RuntimeException(name + " is already checked"); } click(); }