use of com.adobe.cq.wcm.core.components.commons.editor.dialog.inherited.PageImageThumbnail in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class PageImageThumbnailTest method testPageImageThumbnailWithNonExistingResource.
@Test
void testPageImageThumbnailWithNonExistingResource() {
MockSlingHttpServletRequest request = context.request();
MockRequestPathInfo requestPathInfo = (MockRequestPathInfo) request.getRequestPathInfo();
requestPathInfo.setSuffix(RESOURCE1);
PageImageThumbnail pageImageThumbnail = request.adaptTo(PageImageThumbnail.class);
if (pageImageThumbnail != null) {
assertNull(pageImageThumbnail.getAlt(), "getAlt()");
assertNull(pageImageThumbnail.getSrc(), "getSrc()");
}
}
use of com.adobe.cq.wcm.core.components.commons.editor.dialog.inherited.PageImageThumbnail in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class PageImageThumbnailTest method testPageImageThumbnailWithParam.
@Test
void testPageImageThumbnailWithParam() {
context.currentResource(RESOURCE);
MockSlingHttpServletRequest request = context.request();
request.setParameterMap(ImmutableMap.of("item", RESOURCE));
PageImageThumbnail pageImageThumbnail = request.adaptTo(PageImageThumbnail.class);
if (pageImageThumbnail != null) {
assertEquals("featured image alt", pageImageThumbnail.getAlt(), "getAlt()");
assertEquals("/content/page/_jcr_content/_cq_featuredimage.coreimg.png", pageImageThumbnail.getSrc(), "getSrc()");
}
}
use of com.adobe.cq.wcm.core.components.commons.editor.dialog.inherited.PageImageThumbnail in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class PageImageThumbnailTest method testPageImageThumbnailWithLinkURL.
@Test
void testPageImageThumbnailWithLinkURL() {
context.currentResource(RESOURCE);
MockSlingHttpServletRequest request = context.request();
request.setParameterMap(ImmutableMap.of("item", RESOURCE, "pageLink", "/content/page1"));
PageImageThumbnail pageImageThumbnail = request.adaptTo(PageImageThumbnail.class);
if (pageImageThumbnail != null) {
assertEquals("featured image alt for page 1", pageImageThumbnail.getAlt(), "getAlt()");
assertEquals("/content/page1/_jcr_content/_cq_featuredimage.coreimg.png", pageImageThumbnail.getSrc(), "getSrc()");
}
}
use of com.adobe.cq.wcm.core.components.commons.editor.dialog.inherited.PageImageThumbnail in project aem-core-wcm-components by adobe.
the class PageImageThumbnailTest method testPageImageThumbnailWithSuffix.
@Test
void testPageImageThumbnailWithSuffix() {
context.currentResource(RESOURCE);
MockSlingHttpServletRequest request = context.request();
MockRequestPathInfo requestPathInfo = (MockRequestPathInfo) request.getRequestPathInfo();
requestPathInfo.setSuffix(RESOURCE);
requestPathInfo.setResourcePath(RESOURCE);
PageImageThumbnail pageImageThumbnail = request.adaptTo(PageImageThumbnail.class);
if (pageImageThumbnail != null) {
assertEquals("featured image alt", pageImageThumbnail.getAlt(), "getAlt()");
assertEquals("/content/page/_jcr_content/_cq_featuredimage.coreimg.png", pageImageThumbnail.getSrc(), "getSrc()");
assertEquals("/content/page/jcr:content/root/responsivegrid/image", pageImageThumbnail.getComponentPath(), "getComponentPath()");
assertEquals("/content/page/jcr:content/root/responsivegrid/image", pageImageThumbnail.getConfigPath(), "getConfigPath()");
assertEquals("/content/page", pageImageThumbnail.getCurrentPagePath(), "getCurrentPagePath()");
} else {
fail("can't create page image thumnbail model");
}
}
use of com.adobe.cq.wcm.core.components.commons.editor.dialog.inherited.PageImageThumbnail in project aem-core-wcm-components by adobe.
the class PageImageThumbnailTest method testPageImageThumbnailWithoutParam.
@Test
void testPageImageThumbnailWithoutParam() {
context.currentResource(RESOURCE);
MockSlingHttpServletRequest request = context.request();
PageImageThumbnail pageImageThumbnail = request.adaptTo(PageImageThumbnail.class);
if (pageImageThumbnail != null) {
assertNull(pageImageThumbnail.getAlt(), "getAlt()");
assertNull(pageImageThumbnail.getSrc(), "getSrc()");
}
}
Aggregations