Search in sources :

Example 1 with Embed

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));
}
Also used : Embed(com.adobe.cq.wcm.core.components.models.Embed) Style(com.day.cq.wcm.api.designer.Style) Test(org.junit.jupiter.api.Test)

Example 2 with Embed

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));
}
Also used : Embed(com.adobe.cq.wcm.core.components.models.Embed) Style(com.day.cq.wcm.api.designer.Style) Test(org.junit.jupiter.api.Test)

Example 3 with Embed

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));
}
Also used : Embed(com.adobe.cq.wcm.core.components.models.Embed) Style(com.day.cq.wcm.api.designer.Style) Test(org.junit.jupiter.api.Test)

Aggregations

Embed (com.adobe.cq.wcm.core.components.models.Embed)3 Style (com.day.cq.wcm.api.designer.Style)3 Test (org.junit.jupiter.api.Test)3