Search in sources :

Example 11 with ClientLibraries

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

the class ClientLibrariesImplTest method testGetCategoriesWithInjectedResourceType.

@Test
void testGetCategoriesWithInjectedResourceType() {
    Map<String, Object> attributes = new HashMap<>();
    attributes.put("resourceTypes", new HashSet<String>() {

        {
            add("core/wcm/components/accordion/v1/accordion");
        }
    });
    ClientLibraries clientlibs = getClientLibrariesUnderTest(ROOT_PAGE, attributes);
    StringBuilder includes = new StringBuilder();
    includes.append(jsIncludes.get(ACCORDION_CATEGORY));
    includes.append(cssIncludes.get(ACCORDION_CATEGORY));
    assertEquals(includes.toString(), clientlibs.getJsAndCssIncludes());
}
Also used : HashMap(java.util.HashMap) ClientLibraries(com.adobe.cq.wcm.core.components.models.ClientLibraries) Test(org.junit.jupiter.api.Test)

Example 12 with ClientLibraries

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

the class ClientLibrariesImplTest method testGetCategoriesWithInjectedResourceTypesAndInheritanceDisabled.

@Test
void testGetCategoriesWithInjectedResourceTypesAndInheritanceDisabled() {
    Map<String, Object> attributes = new HashMap<>();
    attributes.put("resourceTypes", new HashSet<String>() {

        {
            add("core/wcm/components/accordion/v1/accordion");
            add("core/wcm/components/carousel/v3/carousel");
        }
    });
    attributes.put("inherited", false);
    ClientLibraries clientlibs = getClientLibrariesUnderTest(ROOT_PAGE, attributes);
    StringBuilder includes = new StringBuilder();
    includes.append(jsIncludes.get(ACCORDION_CATEGORY));
    includes.append(cssIncludes.get(ACCORDION_CATEGORY));
    assertEquals(includes.toString(), clientlibs.getJsAndCssIncludes());
}
Also used : HashMap(java.util.HashMap) ClientLibraries(com.adobe.cq.wcm.core.components.models.ClientLibraries) Test(org.junit.jupiter.api.Test)

Example 13 with ClientLibraries

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

the class ClientLibrariesImplTest method testGetCategoriesWithInjectedCategory.

@Test
void testGetCategoriesWithInjectedCategory() {
    Map<String, Object> attributes = new HashMap<>();
    attributes.put("categories", TEASER_CATEGORY);
    ClientLibraries clientlibs = getClientLibrariesUnderTest(ROOT_PAGE, attributes);
    StringBuilder includes = new StringBuilder();
    includes.append(jsIncludes.get(TEASER_CATEGORY));
    includes.append(cssIncludes.get(TEASER_CATEGORY));
    assertEquals(includes.toString(), clientlibs.getJsAndCssIncludes());
}
Also used : HashMap(java.util.HashMap) ClientLibraries(com.adobe.cq.wcm.core.components.models.ClientLibraries) Test(org.junit.jupiter.api.Test)

Aggregations

ClientLibraries (com.adobe.cq.wcm.core.components.models.ClientLibraries)13 HashMap (java.util.HashMap)13 Test (org.junit.jupiter.api.Test)13 HashSet (java.util.HashSet)2 Page (com.day.cq.wcm.api.Page)1 PageManager (com.day.cq.wcm.api.PageManager)1 Resource (org.apache.sling.api.resource.Resource)1