@Test public void stringToKeyUpDoesTrimEntirelyEmptySpaces() { binder.bind(s).toKeyUp(box); box.keyUp('a'); box.keyUp(KeyCodes.KEY_BACKSPACE); assertThat(s.get(), is(nullValue())); }
@Test public void stringToKeyUpDoestTrimOnChange() { binder.bind(s).toKeyUp(box); box.type("a "); assertThat(s.get(), is("a")); }
@Test public void stringToKeyUpUpdatesModelOnKeyUp() { binder.bind(s).toKeyUp(box); box.press('a'); assertThat(s.get(), is("a")); }
@Test public void stringToKeyUpUpdatesModelOnChange() { binder.bind(s).toKeyUp(box); box.type("a"); // just a change, no key up assertThat(s.get(), is("a")); }
@Test public void stringToKeyUpUpdatesViewOnChange() { binder.bind(s).toKeyUp(box); s.set("a"); assertThat(box.getValue(), is("a")); }
@Test public void stringToKeyUpSetsInitialValue() { s.set("a"); binder.bind(s).toKeyUp(box); assertThat(box.getValue(), is("a")); }
@Test public void stringToKeyUpSetsMaxLength() { s.max(20); binder.bind(s).toKeyUp(box); assertThat(box.getMaxLength(), is(20)); }
@Test public void stringToKeyUpSetsMaxLengthOnTextArea() { final StubTextArea box = new StubTextArea(); s.max(20); binder.bind(s).toKeyUp(box); assertThat(box.getMaxLength(), is(20)); }
@Test public void stringToKeyUpDoesNotTrimOnPress() { binder.bind(s).toKeyUp(box); box.keyPress('a'); box.keyPress(' '); box.keyUp(0); // should have a keyUp('a') assertThat(s.get(), is("a ")); }