use of com.enonic.xp.index.PatternIndexConfigDocument 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());
}
use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.
the class DataConfigProcessorTest method test_data.
@Test
public void test_data() throws Exception {
final PatternIndexConfigDocument result = processForm(Form.create().build());
assertEquals(1, result.getPathIndexConfigs().size());
assertEquals(IndexConfig.BY_TYPE, result.getConfigForPath(PropertyPath.from(DATA)));
}
use of com.enonic.xp.index.PatternIndexConfigDocument 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());
}
use of com.enonic.xp.index.PatternIndexConfigDocument 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());
}
use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.
the class PageConfigProcessorTest method test_empty_config.
@Test
public void test_empty_config() throws Exception {
final PatternIndexConfigDocument result = processForm(Form.create().build());
assertEquals(4, result.getPathIndexConfigs().size());
assertTrue(result.getPathIndexConfigs().contains(PathIndexConfig.create().path(PropertyPath.from(COMPONENTS)).indexConfig(IndexConfig.NONE).build()));
assertTrue(result.getPathIndexConfigs().contains(PathIndexConfig.create().path(PropertyPath.from(COMPONENTS, PAGE, DESCRIPTOR)).indexConfig(IndexConfig.MINIMAL).build()));
assertTrue(result.getPathIndexConfigs().contains(PathIndexConfig.create().path(PropertyPath.from(COMPONENTS, PAGE, CUSTOMIZED)).indexConfig(IndexConfig.MINIMAL).build()));
assertTrue(result.getPathIndexConfigs().contains(PathIndexConfig.create().path(PropertyPath.from(COMPONENTS, PAGE, TEMPLATE)).indexConfig(IndexConfig.MINIMAL).build()));
}
Aggregations