use of com.enonic.xp.form.Input in project xp by enonic.
the class TextAreaTypeTest method testCreateDefaultValue.
@Test
public void testCreateDefaultValue() {
final Input input = getDefaultInputBuilder(InputTypeName.TEXT_AREA, "testString").build();
final Value value = this.type.createDefaultValue(input);
assertNotNull(value);
assertEquals("testString", value.toString());
}
use of com.enonic.xp.form.Input in project xp by enonic.
the class DateTimeTypeTest method testCreateDefaultValue_withTimezone_format1.
@Test
public void testCreateDefaultValue_withTimezone_format1() {
final Input input = getDefaultInputBuilder(InputTypeName.DATE_TIME, "2014-08-16T10:03:45Z").inputTypeConfig(InputTypeConfig.create().property(InputTypeProperty.create("timezone", "true").build()).build()).build();
final Value value = this.type.createDefaultValue(input);
assertNotNull(value);
assertSame(ValueTypes.DATE_TIME, value.getType());
assertEquals(value.toString(), "2014-08-16T10:03:45Z");
}
use of com.enonic.xp.form.Input in project xp by enonic.
the class DateTimeTypeTest method testRelativeDefaultValue_date_time.
@Test
public void testRelativeDefaultValue_date_time() {
final Input input = getDefaultInputBuilder(InputTypeName.DATE_TIME, "+1year -5months -36d +2minutes -1h").inputTypeConfig(InputTypeConfig.create().property(InputTypeProperty.create("timezone", "true").build()).build()).build();
final Value value = this.type.createDefaultValue(input);
assertNotNull(value);
assertSame(ValueTypes.DATE_TIME, value.getType());
}
use of com.enonic.xp.form.Input in project xp by enonic.
the class DateTimeTypeTest method testRelativeDefaultValue_only_relative_time_exists.
@Test
public void testRelativeDefaultValue_only_relative_time_exists() {
final Input input = getDefaultInputBuilder(InputTypeName.DATE_TIME, "+1hour -5minutes -36s").inputTypeConfig(InputTypeConfig.create().property(InputTypeProperty.create("timezone", "false").build()).build()).build();
final Value value = this.type.createDefaultValue(input);
assertNotNull(value);
assertSame(ValueTypes.LOCAL_DATE_TIME, value.getType());
}
use of com.enonic.xp.form.Input in project xp by enonic.
the class DateTypeTest method testRelativeDefaultValue.
@Test
public void testRelativeDefaultValue() {
final Input input = getDefaultInputBuilder(InputTypeName.DATE, "+1year -5months -36d").build();
final Value value = this.type.createDefaultValue(input);
assertNotNull(value);
assertSame(ValueTypes.LOCAL_DATE, value.getType());
assertEquals(value.getObject(), LocalDate.now().plusYears(1).plusMonths(-5).plusDays(-36));
}
Aggregations