use of com.adobe.cq.wcm.core.components.models.Embed 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.adobe.cq.wcm.core.components.models.Embed in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class EmbedImplTest method testEmbeddable.
@Test
void testEmbeddable() {
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(true);
Mockito.when(style.get(Embed.PN_DESIGN_EMBEDDABLES_DISABLED, false)).thenReturn(false);
Embed embed = getEmbedUnderTest(PATH_EMBED_2);
assertEquals(Embed.Type.EMBEDDABLE, embed.getType());
assertNull(embed.getUrl());
assertNull(embed.getHtml());
assertEquals("core/wcm/components/embed/v1/embed/embeddable/youtube", embed.getEmbeddableResourceType());
Utils.testJSONExport(embed, Utils.getTestExporterJSONPath(BASE, EMBED_2));
}
use of com.adobe.cq.wcm.core.components.models.Embed in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class EmbedImplTest method testUrl.
@Test
void testUrl() {
style = mock(Style.class);
Mockito.when(style.get(Embed.PN_DESIGN_URL_DISABLED, false)).thenReturn(false);
Mockito.when(style.get(Embed.PN_DESIGN_HTML_DISABLED, false)).thenReturn(true);
Mockito.when(style.get(Embed.PN_DESIGN_EMBEDDABLES_DISABLED, false)).thenReturn(true);
Embed embed = getEmbedUnderTest(PATH_EMBED_1);
assertEquals(Embed.Type.URL, embed.getType());
assertNull(embed.getHtml());
assertNull(embed.getEmbeddableResourceType());
assertEquals("https://www.youtube.com/embed/vpdcMZnYCko", embed.getUrl());
Utils.testJSONExport(embed, Utils.getTestExporterJSONPath(BASE, EMBED_1));
}