@Test public void onClickToggleSetsNoInitialValue() { final BooleanProperty b = booleanProperty("b"); binder.onClick(anchor).toggle(b); assertThat(b.get(), is(nullValue())); }
@Test public void onChangeToggleSetsNoInitialValue() { final BooleanProperty b = booleanProperty("b"); binder.onChange(box).toggle(b); assertThat(b.get(), is(nullValue())); }
@Test public void onClickTogglePreventsDefault() { final BooleanProperty b = booleanProperty("b"); binder.onClick(anchor).toggle(b); final StubClickEvent c = new StubClickEvent(); anchor.fireEvent(c); assertThat(c.prevented, is(true)); }
@Test public void onClickToggleDoesActuallyToggle() { final BooleanProperty b = booleanProperty("b"); binder.onClick(anchor).toggle(b); anchor.click(); assertThat(b.get(), is(true)); anchor.click(); assertThat(b.get(), is(false)); }
@Test public void onChangeToggleDoesActuallyToggle() { final BooleanProperty b = booleanProperty("b"); binder.onChange(box).toggle(b); box.type("asdf"); assertThat(b.get(), is(true)); box.type("fdas"); assertThat(b.get(), is(false)); }