use of com.vaadin.ui.TextField in project linkki by linkki-framework.
the class UIIntegerFieldIntegrationTest method testSetValueWithPrimitiveIntInModelObject.
@Test
public void testSetValueWithPrimitiveIntInModelObject() {
TestModelObjectWithPrimitiveInteger modelObject = new TestModelObjectWithPrimitiveInteger();
TextField textField = createFirstComponent(modelObject);
assertThat(textField.getMaxLength(), is(MAX_LENGTH));
assertThat(textField.getValue(), is(formatter.format(0)));
textField.setValue(formatter.format(1));
assertThat(modelObject.getValue(), is(1));
modelObject.setValue(2000);
// updateUi(); not needed at the moment
assertThat(textField.getValue(), is(formatter.format(2000)));
}
use of com.vaadin.ui.TextField in project linkki by linkki-framework.
the class UIIntegerFieldIntegrationTest method testSetValueWithPrimitiveIntegerInModelObjectFailsForNull.
@Test(expected = Buffered.SourceException.class)
public void testSetValueWithPrimitiveIntegerInModelObjectFailsForNull() {
TextField textField = createFirstComponent(new TestModelObjectWithPrimitiveInteger());
textField.setValue(null);
}
use of com.vaadin.ui.TextField in project linkki by linkki-framework.
the class UITextFieldIntegrationTest method testNullInputIfRequired.
@Test
@Override
public void testNullInputIfRequired() {
TextField textField = getDynamicComponent();
getDefaultPmo().setRequired(true);
updateUi();
assertThat(textField.isRequired(), is(true));
textField.setValue("something");
assertThat(getDefaultModelObject().getValue(), is("something"));
textField.setValue(null);
assertThat(getDefaultModelObject().getValue(), is(nullValue()));
}
use of com.vaadin.ui.TextField in project linkki by linkki-framework.
the class UiIntegerFieldTest method testSetValueWithPrimitiveIntegerInModelObject.
@Test
public void testSetValueWithPrimitiveIntegerInModelObject() {
TextField textField = createIntegerTextField(new TestModelObjectWithPrimitiveInteger());
// No assertions needed, we just make sure no exception is thrown
textField.setValue("0");
}
use of com.vaadin.ui.TextField in project linkki by linkki-framework.
the class BindAnnotationDescriptorTest method testCreateBinding_CreatesFieldBindingForField.
@Test
public void testCreateBinding_CreatesFieldBindingForField() {
BindAnnotationDescriptor descriptor = new BindAnnotationDescriptor(mock(Bind.class), new ArrayList<>());
PropertyDispatcher dispatcher = mock(PropertyDispatcher.class);
ElementBinding binding = descriptor.createBinding(dispatcher, Handler.NOP_HANDLER, new LabelComponentWrapper(new TextField()));
assertThat(binding, is(instanceOf(ComponentBinding.class)));
}
Aggregations