use of com.adobe.cq.wcm.core.components.models.LayoutContainer in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class LayoutContainerImplTest method testContainerNoProperties.
@Test
public void testContainerNoProperties() {
LayoutContainer container = getContainerUnderTest(CONTAINER_2);
assertEquals("container-2611f8dc62", container.getId(), "ID mismatch");
assertNull(container.getBackgroundStyle(), "Style");
assertEquals(LayoutContainer.LayoutType.SIMPLE, container.getLayout(), "Layout type mismatch");
}
use of com.adobe.cq.wcm.core.components.models.LayoutContainer in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class LayoutContainerImplTest method testContainerWithPropertiesAndPolicy.
@Test
public void testContainerWithPropertiesAndPolicy() {
context.contentPolicyMapping(LayoutContainerImpl.RESOURCE_TYPE_V1, new HashMap<String, Object>() {
{
put(Container.PN_BACKGROUND_IMAGE_ENABLED, true);
put(Container.PN_BACKGROUND_COLOR_ENABLED, true);
put(LayoutContainer.PN_LAYOUT, "simple");
}
});
LayoutContainer container = getContainerUnderTest(CONTAINER_1);
assertEquals("background-image:url(/content/dam/core-components-examples/library/sample-assets/mountain-range.jpg);background-size:cover;background-repeat:no-repeat;background-color:#000000;", container.getBackgroundStyle(), "Style mismatch");
// layout set in component properties
assertEquals(LayoutContainer.LayoutType.RESPONSIVE_GRID, container.getLayout(), "Layout type mismatch");
assertEquals("test", container.getId(), "ID mismatch");
Object[][] expectedItems = { { "item_1", "Teaser 1" }, { "item_2", "Teaser 2" } };
verifyContainerItems(expectedItems, container.getItems());
assertEquals("core/wcm/components/container/v1/container", container.getExportedType(), "Exported type mismatch");
Utils.testJSONExport(container, Utils.getTestExporterJSONPath(TEST_BASE, "container1"));
}
use of com.adobe.cq.wcm.core.components.models.LayoutContainer in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class LayoutContainerImplTest method testGetRoleAttribute.
@Test
protected void testGetRoleAttribute() {
context.contentPolicyMapping(LayoutContainerImpl.RESOURCE_TYPE_V1, new HashMap<String, Object>() {
{
put(LayoutContainer.PN_LAYOUT, "responsiveGrid");
}
});
LayoutContainer container = getContainerUnderTest(CONTAINER_2);
assertEquals("main", container.getRoleAttribute());
Utils.testJSONExport(container, Utils.getTestExporterJSONPath(TEST_BASE, "container2"));
}
use of com.adobe.cq.wcm.core.components.models.LayoutContainer in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class LayoutContainerImplTest method testGetAccessibilityLabel.
@Test
protected void testGetAccessibilityLabel() {
context.contentPolicyMapping(LayoutContainerImpl.RESOURCE_TYPE_V1, new HashMap<String, Object>() {
{
put(LayoutContainer.PN_LAYOUT, "responsiveGrid");
}
});
LayoutContainer container = getContainerUnderTest(CONTAINER_2);
assertEquals("container", container.getAccessibilityLabel());
Utils.testJSONExport(container, Utils.getTestExporterJSONPath(TEST_BASE, "container2"));
}
use of com.adobe.cq.wcm.core.components.models.LayoutContainer in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class LayoutContainerImplTest method testSpaceEscapingInBackgroundImage.
@Test
public void testSpaceEscapingInBackgroundImage() {
context.contentPolicyMapping(LayoutContainerImpl.RESOURCE_TYPE_V1, new HashMap<String, Object>() {
{
put(Container.PN_BACKGROUND_IMAGE_ENABLED, true);
put(Container.PN_BACKGROUND_COLOR_ENABLED, true);
put(LayoutContainer.PN_LAYOUT, "simple");
}
});
LayoutContainer container = getContainerUnderTest(CONTAINER_4);
assertEquals("container-ece469fc8b", container.getId(), "ID mismatch");
assertEquals("background-image:url(/content/dam/core-components-examples/library/sample-assets/mountain%20range.jpg);background-size:cover;background-repeat:no-repeat;background-color:#000000;", container.getBackgroundStyle(), "Style mismatch");
}
Aggregations