use of com.vaadin.flow.component.textfield.TextField in project linkki by linkki-framework.
the class UITextFieldIntegrationTest method testTextVieldValue.
@Test
void testTextVieldValue() {
TestModelObjectWithString modelObject = new TestModelObjectWithString();
TextField textField = createFirstComponent(modelObject);
assertThat(textField.getMaxLength(), is(MAX_LENGTH));
assertThat(textField.getWidth(), is("42em"));
assertThat(textField.getValue(), is(""));
TestUiUtil.setUserOriginatedValue(textField, "asdf");
assertThat(modelObject.getValue(), is("asdf"));
modelObject.setValue("fdsa");
getBindingContext().modelChanged();
assertThat(textField.getValue(), is("fdsa"));
// clearing textfield results in ""
TestUiUtil.setUserOriginatedValue(textField, textField.getEmptyValue());
assertThat(modelObject.getValue(), is(emptyString()));
}
use of com.vaadin.flow.component.textfield.TextField in project linkki by linkki-framework.
the class UITextFieldIntegrationTest method testNullInputIfRequired.
@Test
@Override
void testNullInputIfRequired() {
TextField textField = getDynamicComponent();
getDefaultPmo().setRequired(true);
modelChanged();
assertThat(textField.isRequiredIndicatorVisible(), is(true));
TestUiUtil.setUserOriginatedValue(textField, "something");
assertThat(getDefaultModelObject().getValue(), is("something"));
// clearing textfield results in ""
TestUiUtil.setUserOriginatedValue(textField, textField.getEmptyValue());
assertThat(getDefaultModelObject().getValue(), is(emptyString()));
}
use of com.vaadin.flow.component.textfield.TextField in project linkki by linkki-framework.
the class FormItemComponentWrapperTest method testSetTooltip.
@Test
void testSetTooltip() {
TextField formTextField = new TextField();
LabelComponentFormItem formItem = new LabelComponentFormItem(formTextField, new Label("SomeText"));
FormItemComponentWrapper wrapper = new FormItemComponentWrapper(formItem);
wrapper.setTooltip("testTip");
assertThat(getTitleAttribute(wrapper), is("testTip"));
wrapper.setTooltip("<script>");
assertThat(getTitleAttribute(wrapper), is(""));
wrapper.setTooltip("<div> some text </div>");
assertThat(getTitleAttribute(wrapper), is(" some text "));
wrapper.setTooltip("<div> some text <br> with page break</div> ");
assertThat(getTitleAttribute(wrapper), is(" some text \n with page break "));
}
use of com.vaadin.flow.component.textfield.TextField in project linkki by linkki-framework.
the class LabelComponentWrapperTest method testSetLabel_Null.
@Test
public void testSetLabel_Null() {
TextField component = new TextField();
LabelComponentWrapper wrapper = new LabelComponentWrapper(component, WrapperType.FIELD);
wrapper.setLabel(null);
assertThat(component.getElement().hasProperty("label"), is(false));
}
use of com.vaadin.flow.component.textfield.TextField in project linkki by linkki-framework.
the class LabelComponentWrapperTest method testSetLabel.
@Test
public void testSetLabel() {
TextField component = new TextField();
LabelComponentWrapper wrapper = new LabelComponentWrapper(component, WrapperType.FIELD);
wrapper.setLabel("Label Text");
assertThat(component.getElement().getProperty("label"), is("Label Text"));
}
Aggregations