use of com.day.cq.wcm.api.designer.Style 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" });
}
use of com.day.cq.wcm.api.designer.Style in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class TitleImplTest method testGetTitleResourcePageStyleType.
@Test
public void testGetTitleResourcePageStyleType() {
context.currentResource(TITLE_NOPROPS);
Style style = Mockito.mock(Style.class);
when(style.get(Title.PN_DESIGN_DEFAULT_TYPE, String.class)).thenReturn("h2");
slingBindings.put(WCMBindings.CURRENT_STYLE, style);
underTest = context.request().adaptTo(Title.class);
assertEquals("h2", underTest.getType());
}
use of com.day.cq.wcm.api.designer.Style in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class EmbedImplTest method testHtml.
@Test
void testHtml() {
style = mock(Style.class);
Mockito.when(style.get(Embed.PN_DESIGN_URL_DISABLED, false)).thenReturn(true);
Mockito.when(style.get(Embed.PN_DESIGN_HTML_DISABLED, false)).thenReturn(false);
Mockito.when(style.get(Embed.PN_DESIGN_EMBEDDABLES_DISABLED, false)).thenReturn(true);
Embed embed = getEmbedUnderTest(PATH_EMBED_3);
assertEquals(Embed.Type.HTML, embed.getType());
assertNull(embed.getUrl());
assertNull(embed.getEmbeddableResourceType());
assertEquals("<div>html</div>", embed.getHtml());
Utils.testJSONExport(embed, Utils.getTestExporterJSONPath(BASE, EMBED_3));
}
use of com.day.cq.wcm.api.designer.Style in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class DownloadImplTest method testDownloadWithDefaultTitleType.
@Test
void testDownloadWithDefaultTitleType() {
Resource mockResource = mock(Resource.class);
Style mockStyle = new MockStyle(mockResource, new MockValueMap(mockResource));
Download download = getDownloadUnderTest(DOWNLOAD_1, mockStyle);
assertNull(download.getTitleType(), "Expected title type is not correct");
Utils.testJSONExport(download, Utils.getTestExporterJSONPath(TEST_BASE, DOWNLOAD_FULLY_CONFIGURED));
}
use of com.day.cq.wcm.api.designer.Style in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class YouTubeImplTest method testGetStyleForWrappedResource.
@Test
public void testGetStyleForWrappedResource() {
YouTubeImpl youTube = getYouTubeUnderTest(PATH_VIDEO_3, page);
Resource resource = context.resourceResolver().getResource(PATH_VIDEO_3);
if (resource == null) {
throw new IllegalStateException("Did you forget to define test resource " + PATH_VIDEO_3 + "?");
}
context.contentPolicyMapping(resource.getResourceType(), Collections.singletonMap("test", "foo"));
Style style = youTube.getStyleForWrappedResource(new ResourceWrapper(resource) {
@Override
public String getResourceType() {
return "overriddenResourceType";
}
});
assertEquals("foo", style.get("test", "bar"));
}
Aggregations