Search in sources :

Example 6 with MockStyle

use of com.adobe.cq.wcm.core.components.context.MockStyle in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ListImplTest method testOrderByModificationDateDesc.

@Test
public void testOrderByModificationDateDesc() throws Exception {
    Resource resource = context.currentResource("/content/list/listTypes/staticOrderByModificationDateDescListType");
    slingBindings.put(WCMBindings.PROPERTIES, resource.adaptTo(ValueMap.class));
    slingBindings.put(WCMBindings.CURRENT_STYLE, new MockStyle(resource));
    List list = context.request().adaptTo(List.class);
    checkListConsistency(list, new String[] { "Page 1", "Page 2" });
}
Also used : ValueMap(org.apache.sling.api.resource.ValueMap) Resource(org.apache.sling.api.resource.Resource) MockStyle(com.adobe.cq.wcm.core.components.context.MockStyle) List(com.adobe.cq.wcm.core.components.models.List) Test(org.junit.Test)

Example 7 with MockStyle

use of com.adobe.cq.wcm.core.components.context.MockStyle in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ListImplTest method testStaticListType.

@Test
public void testStaticListType() {
    Resource resource = context.currentResource("/content/list/listTypes/staticListType");
    slingBindings.put(WCMBindings.PROPERTIES, resource.adaptTo(ValueMap.class));
    slingBindings.put(WCMBindings.CURRENT_STYLE, new MockStyle(resource));
    List list = context.request().adaptTo(List.class);
    assertEquals(2, list.getItems().size());
}
Also used : ValueMap(org.apache.sling.api.resource.ValueMap) Resource(org.apache.sling.api.resource.Resource) MockStyle(com.adobe.cq.wcm.core.components.context.MockStyle) List(com.adobe.cq.wcm.core.components.models.List) Test(org.junit.Test)

Example 8 with MockStyle

use of com.adobe.cq.wcm.core.components.context.MockStyle in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ListImplTest method testProperties.

@Test
public void testProperties() throws Exception {
    Resource resource = context.currentResource("/content/list/listTypes/staticListType");
    slingBindings.put(WCMBindings.PROPERTIES, resource.adaptTo(ValueMap.class));
    slingBindings.put(WCMBindings.CURRENT_STYLE, new MockStyle(resource));
    List list = context.request().adaptTo(List.class);
    assertTrue(list.showDescription());
    assertTrue(list.showModificationDate());
    assertTrue(list.linkItems());
}
Also used : ValueMap(org.apache.sling.api.resource.ValueMap) Resource(org.apache.sling.api.resource.Resource) MockStyle(com.adobe.cq.wcm.core.components.context.MockStyle) List(com.adobe.cq.wcm.core.components.models.List) Test(org.junit.Test)

Example 9 with MockStyle

use of com.adobe.cq.wcm.core.components.context.MockStyle in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ListImplTest method testChildrenListType.

@Test
public void testChildrenListType() throws Exception {
    Resource resource = context.currentResource("/content/list/listTypes/childrenListType");
    slingBindings.put(WCMBindings.PROPERTIES, resource.adaptTo(ValueMap.class));
    slingBindings.put(WCMBindings.CURRENT_STYLE, new MockStyle(resource));
    List list = context.request().adaptTo(List.class);
    assertEquals(3, list.getItems().size());
}
Also used : ValueMap(org.apache.sling.api.resource.ValueMap) Resource(org.apache.sling.api.resource.Resource) MockStyle(com.adobe.cq.wcm.core.components.context.MockStyle) List(com.adobe.cq.wcm.core.components.models.List) Test(org.junit.Test)

Example 10 with MockStyle

use of com.adobe.cq.wcm.core.components.context.MockStyle in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class BreadcrumbImplTest method testGetHideCurrent.

@Test
public void testGetHideCurrent() throws Exception {
    Resource resource = context.currentResource(CURRENT_PAGE + "/jcr:content/header/breadcrumb-hide-current");
    slingBindings.put(WCMBindings.PROPERTIES, resource.adaptTo(ValueMap.class));
    slingBindings.put(WCMBindings.CURRENT_STYLE, new MockStyle(resource));
    underTest = context.request().adaptTo(Breadcrumb.class);
    checkBreadcrumbConsistency(new String[] { "Women" });
}
Also used : ValueMap(org.apache.sling.api.resource.ValueMap) Resource(org.apache.sling.api.resource.Resource) MockStyle(com.adobe.cq.wcm.core.components.context.MockStyle) Breadcrumb(com.adobe.cq.wcm.core.components.models.Breadcrumb) Test(org.junit.Test)

Aggregations

MockStyle (com.adobe.cq.wcm.core.components.context.MockStyle)19 Resource (org.apache.sling.api.resource.Resource)19 Test (org.junit.Test)18 ValueMap (org.apache.sling.api.resource.ValueMap)15 List (com.adobe.cq.wcm.core.components.models.List)11 Breadcrumb (com.adobe.cq.wcm.core.components.models.Breadcrumb)4 Title (com.adobe.cq.wcm.core.components.models.Title)3 Hit (com.day.cq.search.result.Hit)1 SearchResult (com.day.cq.search.result.SearchResult)1 Template (com.day.cq.wcm.api.Template)1 Design (com.day.cq.wcm.api.designer.Design)1 Style (com.day.cq.wcm.api.designer.Style)1 ContentPolicy (com.day.cq.wcm.api.policies.ContentPolicy)1 ContentPolicyMapping (com.day.cq.wcm.api.policies.ContentPolicyMapping)1 SlingBindings (org.apache.sling.api.scripting.SlingBindings)1 MockSlingHttpServletRequest (org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest)1