use of com.qcadoo.view.internal.components.TextInputComponentPattern in project qcadoo by qcadoo.
the class ComponentPatternTest method shouldHaveDefaultEnabledFlag.
@Test
public void shouldHaveDefaultEnabledFlag() throws Exception {
// given
ComponentDefinition componentDefinition = getComponentDefinition("testName", null);
componentDefinition.setDefaultEnabled(false);
AbstractComponentPattern pattern = new TextInputComponentPattern(componentDefinition);
// then
assertFalse(pattern.isDefaultEnabled());
}
use of com.qcadoo.view.internal.components.TextInputComponentPattern in project qcadoo by qcadoo.
the class ComponentPatternTest method shouldHaveListenersOnEmptyOptions.
@Test
public void shouldHaveListenersOnEmptyOptions() throws Exception {
// given
TranslationService translationService = mock(TranslationService.class);
InternalViewDefinition viewDefinition = mock(InternalViewDefinition.class);
ComponentDefinition componentDefinition = getComponentDefinition("testName", null);
componentDefinition.setTranslationService(translationService);
componentDefinition.setViewDefinition(viewDefinition);
AbstractComponentPattern pattern = new TextInputComponentPattern(componentDefinition);
// when
Map<String, Object> model = pattern.prepareView(Locale.ENGLISH);
// then
JSONObject options = (JSONObject) model.get("jsOptions");
assertEquals(7, options.length());
}
use of com.qcadoo.view.internal.components.TextInputComponentPattern in project qcadoo by qcadoo.
the class ComponentPatternTest method shouldHaveDefaultVisibleFlag.
@Test
public void shouldHaveDefaultVisibleFlag() throws Exception {
// given
ComponentDefinition componentDefinition = getComponentDefinition("testName", null);
componentDefinition.setDefaultVisible(false);
AbstractComponentPattern pattern = new TextInputComponentPattern(componentDefinition);
// then
assertFalse(pattern.isDefaultVisible());
}
use of com.qcadoo.view.internal.components.TextInputComponentPattern in project qcadoo by qcadoo.
the class ComponentPatternTest method shouldReturnValidPath.
@Test
public void shouldReturnValidPath() throws Exception {
// given
ContainerPattern root = new WindowComponentPattern(getComponentDefinition("rootName", null));
ContainerPattern child1 = new WindowComponentPattern(getComponentDefinition("child1", root, null));
ComponentPattern child2 = new TextInputComponentPattern(getComponentDefinition("child2", root, null));
ComponentPattern child11 = new TextInputComponentPattern(getComponentDefinition("child11", child1, null));
// when
String rootPathName = root.getPath();
String child1PathName = child1.getPath();
String child2PathName = child2.getPath();
String child11PathName = child11.getPath();
// then
Assert.assertEquals("rootName", rootPathName);
Assert.assertEquals("rootName.child1", child1PathName);
Assert.assertEquals("rootName.child2", child2PathName);
Assert.assertEquals("rootName.child1.child11", child11PathName);
}
use of com.qcadoo.view.internal.components.TextInputComponentPattern in project qcadoo by qcadoo.
the class ContainerPatternTest method shouldReturnChildByName.
@Test
public void shouldReturnChildByName() throws Exception {
// given
AbstractContainerPattern parent = new FormComponentPattern(getComponentDefinition("test", null));
ComponentPattern child1 = new TextInputComponentPattern(getComponentDefinition("test1", parent, null));
parent.addChild(child1);
// when
ComponentPattern child = parent.getChild("test1");
// then
Assert.assertEquals(child1, child);
}
Aggregations