Search in sources :

Example 21 with Input

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

the class IndexConfigVisitorTest method top_htmlArea.

@Test
public void top_htmlArea() throws Exception {
    Input myTextLine = Input.create().name("htmlArea").inputType(InputTypeName.HTML_AREA).label("htmlArea").required(true).build();
    Form form = Form.create().addFormItem(myTextLine).build();
    final PatternIndexConfigDocument.Builder builder = PatternIndexConfigDocument.create();
    final IndexConfigVisitor validationVisitor = new IndexConfigVisitor("parent", builder);
    validationVisitor.traverse(form);
    final PatternIndexConfigDocument document = builder.build();
    assertEquals(1, document.getPathIndexConfigs().size());
    assertEquals("htmlStripper", document.getConfigForPath(PropertyPath.from("parent.htmlArea")).getIndexValueProcessors().get(0).getName());
}
Also used : Input(com.enonic.xp.form.Input) Form(com.enonic.xp.form.Form) PatternIndexConfigDocument(com.enonic.xp.index.PatternIndexConfigDocument) Test(org.junit.jupiter.api.Test)

Example 22 with Input

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

the class DataConfigProcessorTest method test_data_form_with_html_area.

@Test
public void test_data_form_with_html_area() throws Exception {
    Input myTextLine = Input.create().name("htmlArea").inputType(InputTypeName.HTML_AREA).label("htmlArea").required(true).build();
    Form form = Form.create().addFormItem(myTextLine).build();
    final PatternIndexConfigDocument result = processForm(form);
    assertEquals(2, result.getPathIndexConfigs().size());
    assertEquals("htmlStripper", result.getConfigForPath(PropertyPath.from(DATA + ".htmlArea")).getIndexValueProcessors().get(0).getName());
}
Also used : Input(com.enonic.xp.form.Input) Form(com.enonic.xp.form.Form) PatternIndexConfigDocument(com.enonic.xp.index.PatternIndexConfigDocument) Test(org.junit.jupiter.api.Test)

Example 23 with Input

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

the class PageConfigProcessorTest method test_page_config_form_with_html_area_simple.

@Test
public void test_page_config_form_with_html_area_simple() throws Exception {
    Input myTextLine = Input.create().name("htmlArea").inputType(InputTypeName.HTML_AREA).label("htmlArea").required(true).build();
    Form form = Form.create().addFormItem(myTextLine).build();
    final PatternIndexConfigDocument result = processForm(form);
    assertEquals(6, result.getPathIndexConfigs().size());
    assertTrue(result.getPathIndexConfigs().contains(PathIndexConfig.create().path(PropertyPath.from(COMPONENTS, PAGE, CONFIG, descriptorKey.getApplicationKey().toString(), descriptorKey.getName())).indexConfig(IndexConfig.BY_TYPE).build()));
    assertEquals("htmlStripper", result.getConfigForPath(PropertyPath.from(COMPONENTS, PAGE, CONFIG, descriptorKey.getApplicationKey().toString(), descriptorKey.getName(), "htmlarea")).getIndexValueProcessors().get(0).getName());
}
Also used : Input(com.enonic.xp.form.Input) Form(com.enonic.xp.form.Form) PatternIndexConfigDocument(com.enonic.xp.index.PatternIndexConfigDocument) Test(org.junit.jupiter.api.Test)

Example 24 with Input

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

the class XDataConfigProcessorTest method test_data_form_with_html_area.

@Test
public void test_data_form_with_html_area() throws Exception {
    Input myTextLine = Input.create().name("htmlArea").inputType(InputTypeName.HTML_AREA).label("htmlArea").required(true).build();
    Form form = Form.create().addFormItem(myTextLine).build();
    final PatternIndexConfigDocument result = processForms(form);
    assertEquals(2, result.getPathIndexConfigs().size());
    assertEquals("htmlStripper", result.getConfigForPath(PropertyPath.from(EXTRA_DATA + ".appname.localname0.htmlarea")).getIndexValueProcessors().get(0).getName());
}
Also used : Input(com.enonic.xp.form.Input) Form(com.enonic.xp.form.Form) PatternIndexConfigDocument(com.enonic.xp.index.PatternIndexConfigDocument) Test(org.junit.jupiter.api.Test)

Example 25 with Input

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

the class XmlTaskDescriptorParserTest method assertResult.

private void assertResult() throws Exception {
    final TaskDescriptor result = this.builder.build();
    assertEquals("myapplication:mytask", result.getKey().toString());
    assertEquals("mytask", result.getName());
    assertEquals("My task", result.getDescription());
    final Form config = result.getConfig();
    assertNotNull(config);
    final Input input = config.getInput("param1");
    assertNotNull(input);
}
Also used : TaskDescriptor(com.enonic.xp.task.TaskDescriptor) Input(com.enonic.xp.form.Input) Form(com.enonic.xp.form.Form)

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