Search in sources :

Example 46 with Input

use of com.enonic.xp.form.Input in project xp by enonic.

the class DateTimeTypeTest method testCreateDefaultValue.

@Test
public void testCreateDefaultValue() {
    final Input input = getDefaultInputBuilder(InputTypeName.DATE_TIME, "2014-08-16T05:03:45").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());
    assertEquals(value.toString(), "2014-08-16T05:03:45");
}
Also used : Input(com.enonic.xp.form.Input) Value(com.enonic.xp.data.Value) Test(org.junit.jupiter.api.Test)

Example 47 with Input

use of com.enonic.xp.form.Input in project xp by enonic.

the class DateTypeTest method testCreateDefaultValue.

@Test
public void testCreateDefaultValue() {
    final Input input = getDefaultInputBuilder(InputTypeName.DATE, "2014-08-16").build();
    final Value value = this.type.createDefaultValue(input);
    assertNotNull(value);
    assertSame(ValueTypes.LOCAL_DATE, value.getType());
    assertEquals(value.toString(), "2014-08-16");
}
Also used : Input(com.enonic.xp.form.Input) Value(com.enonic.xp.data.Value) Test(org.junit.jupiter.api.Test)

Example 48 with Input

use of com.enonic.xp.form.Input in project xp by enonic.

the class LongTypeTest method testCreateDefaultValue.

@Test
public void testCreateDefaultValue() {
    final Input input = getDefaultInputBuilder(InputTypeName.LONG, "2").build();
    final Value value = this.type.createDefaultValue(input);
    assertNotNull(value);
    assertEquals(2L, value.asLong().longValue());
}
Also used : Input(com.enonic.xp.form.Input) Value(com.enonic.xp.data.Value) Test(org.junit.jupiter.api.Test)

Example 49 with Input

use of com.enonic.xp.form.Input in project xp by enonic.

the class DoubleTypeTest method testCreateDefaultValue.

@Test
public void testCreateDefaultValue() {
    final Input input = getDefaultInputBuilder(InputTypeName.DOUBLE, "1.3").build();
    final Value value = this.type.createDefaultValue(input);
    assertNotNull(value);
    assertEquals(1.3D, value.asDouble(), Double.MIN_NORMAL);
}
Also used : Input(com.enonic.xp.form.Input) Value(com.enonic.xp.data.Value) Test(org.junit.jupiter.api.Test)

Example 50 with Input

use of com.enonic.xp.form.Input in project xp by enonic.

the class XmlContentTypeParserTest method testI18n_formInput.

@Test
public void testI18n_formInput() throws Exception {
    parse(this.parser, "-i18n.xml");
    final ContentType result = this.builder.build();
    final Input input = (Input) result.getForm().getFormItem("textLine");
    assertEquals("translated.label", input.getLabelI18nKey());
    assertEquals("translated.help-text", input.getHelpTextI18nKey());
}
Also used : Input(com.enonic.xp.form.Input) ContentType(com.enonic.xp.schema.content.ContentType) Test(org.junit.jupiter.api.Test)

Aggregations

Input (com.enonic.xp.form.Input)62 Test (org.junit.jupiter.api.Test)47 Value (com.enonic.xp.data.Value)24 Form (com.enonic.xp.form.Form)15 PropertyTree (com.enonic.xp.data.PropertyTree)11 FormItem (com.enonic.xp.form.FormItem)9 FormItemSet (com.enonic.xp.form.FormItemSet)9 FormDefaultValuesProcessor (com.enonic.xp.form.FormDefaultValuesProcessor)7 ContentType (com.enonic.xp.schema.content.ContentType)7 FormOptionSet (com.enonic.xp.form.FormOptionSet)5 FieldSet (com.enonic.xp.form.FieldSet)4 FormOptionSetOption (com.enonic.xp.form.FormOptionSetOption)4 PatternIndexConfigDocument (com.enonic.xp.index.PatternIndexConfigDocument)4 Property (com.enonic.xp.data.Property)3 Occurrences (com.enonic.xp.form.Occurrences)3 Content (com.enonic.xp.content.Content)2 ExtraData (com.enonic.xp.content.ExtraData)2 ValidationErrors (com.enonic.xp.content.ValidationErrors)2 PropertyPath (com.enonic.xp.data.PropertyPath)2 PropertySet (com.enonic.xp.data.PropertySet)2