Search in sources :

Example 1 with Breadcrumb

use of com.adobe.cq.wcm.core.components.models.Breadcrumb 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)

Example 2 with Breadcrumb

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

the class BreadcrumbImplTest method testStyleBasedBreadcrumb.

@Test
public void testStyleBasedBreadcrumb() throws Exception {
    Resource resource = context.currentResource(CURRENT_PAGE + "/jcr:content/header/breadcrumb-style-based");
    slingBindings.put(WCMBindings.PROPERTIES, resource.adaptTo(ValueMap.class));
    Style style = mock(Style.class);
    when(style.get(BreadcrumbImpl.PN_START_LEVEL, BreadcrumbImpl.PROP_START_LEVEL_DEFAULT)).thenReturn(3);
    when(style.get(BreadcrumbImpl.PN_HIDE_CURRENT, BreadcrumbImpl.PROP_SHOW_HIDDEN_DEFAULT)).thenReturn(false);
    when(style.get(BreadcrumbImpl.PN_SHOW_HIDDEN, BreadcrumbImpl.PROP_SHOW_HIDDEN_DEFAULT)).thenReturn(false);
    slingBindings.put(WCMBindings.CURRENT_STYLE, style);
    underTest = context.request().adaptTo(Breadcrumb.class);
    checkBreadcrumbConsistency(new String[] { "Devi Sleeveless Shirt" });
}
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) Style(com.day.cq.wcm.api.designer.Style) Breadcrumb(com.adobe.cq.wcm.core.components.models.Breadcrumb) Test(org.junit.Test)

Example 3 with Breadcrumb

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

the class BreadcrumbImplTest method testStartLevel.

@Test
public void testStartLevel() throws Exception {
    Resource resource = context.currentResource(CURRENT_PAGE + "/jcr:content/header/breadcrumb-start-level");
    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[] { "Shirts", "Devi Sleeveless Shirt" });
}
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)

Example 4 with Breadcrumb

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

the class BreadcrumbImplTest method testBreadcrumbItems.

@Test
public void testBreadcrumbItems() throws Exception {
    Resource resource = context.currentResource(CURRENT_PAGE + "/jcr:content/header/breadcrumb");
    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", "Devi Sleeveless Shirt" });
}
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)

Example 5 with Breadcrumb

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

the class BreadcrumbImplTest method testGetShowHidden.

@Test
public void testGetShowHidden() throws Exception {
    Resource resource = context.currentResource(CURRENT_PAGE + "/jcr:content/header/breadcrumb-show-hidden");
    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", "Shirts", "Devi Sleeveless Shirt" });
}
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)5 Breadcrumb (com.adobe.cq.wcm.core.components.models.Breadcrumb)5 Resource (org.apache.sling.api.resource.Resource)5 ValueMap (org.apache.sling.api.resource.ValueMap)5 Test (org.junit.Test)5 Style (com.day.cq.wcm.api.designer.Style)1