Search in sources :

Example 11 with Title

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

the class CoreComponentsMockTest method testLinkHandling.

/**
 * Tests a component with link handling that depends on the presence of a path processor implementation.
 */
@Test
void testLinkHandling() {
    Page page = context.create().page("/content/test");
    Resource resource = context.create().resource(page, "title", "sling:resourceType", "core/wcm/components/title/v3/title", "linkURL", "https://example.com");
    context.currentResource(resource);
    Title title = context.request().adaptTo(Title.class);
    assertNotNull(title, "Unable instantiate title component");
    assertNotNull(title.getLink(), "Missing link");
    assertEquals("https://example.com", title.getLink().getURL());
}
Also used : Resource(org.apache.sling.api.resource.Resource) Title(com.adobe.cq.wcm.core.components.models.Title) Page(com.day.cq.wcm.api.Page) Test(org.junit.jupiter.api.Test)

Example 12 with Title

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

the class TitleImplTest method testGetLink.

@Test
@Override
protected void testGetLink() {
    Title title = getTitleUnderTest(TITLE_RESOURCE_JCR_TITLE_LINK_V2);
    assertValidLink(title.getLink(), "https://www.adobe.com", "World", "World title");
    Utils.testJSONExport(title, Utils.getTestExporterJSONPath(testBase, TITLE_RESOURCE_JCR_TITLE_LINK_V2));
}
Also used : Title(com.adobe.cq.wcm.core.components.models.Title) Test(org.junit.jupiter.api.Test)

Example 13 with Title

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

the class TitleImplTest method testExportedType.

@Test
protected void testExportedType() {
    Title title = getTitleUnderTest(TITLE_RESOURCE_JCR_TITLE);
    assertEquals(resourceType, title.getExportedType());
    Utils.testJSONExport(title, Utils.getTestExporterJSONPath(testBase, TITLE_RESOURCE_JCR_TITLE));
}
Also used : Title(com.adobe.cq.wcm.core.components.models.Title) Test(org.junit.jupiter.api.Test)

Example 14 with Title

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

the class TitleImplTest method testGetTitleFromResource.

@Test
protected void testGetTitleFromResource() {
    Title title = getTitleUnderTest(TITLE_RESOURCE_JCR_TITLE);
    assertNull(title.getType());
    Utils.testJSONExport(title, Utils.getTestExporterJSONPath(testBase, TITLE_RESOURCE_JCR_TITLE));
}
Also used : Title(com.adobe.cq.wcm.core.components.models.Title) Test(org.junit.jupiter.api.Test)

Example 15 with Title

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

the class TitleImplTest method testGetLinkFromRedirectToExternalURL.

@Test
protected void testGetLinkFromRedirectToExternalURL() {
    Title title = getTitleUnderTest(TITLE_RESOURCE_TITLE_V2_REDIRECT_EXTERNAL_URL);
    assertValidLink(title.getLink(), "https://www.adobe.com", "Adobe", "Adobe title");
    Utils.testJSONExport(title, Utils.getTestExporterJSONPath(testBase, TITLE_RESOURCE_TITLE_V2_REDIRECT_EXTERNAL_URL));
}
Also used : Title(com.adobe.cq.wcm.core.components.models.Title) Test(org.junit.jupiter.api.Test)

Aggregations

Title (com.adobe.cq.wcm.core.components.models.Title)17 Test (org.junit.jupiter.api.Test)17 Page (com.day.cq.wcm.api.Page)1 StringReader (java.io.StringReader)1 Resource (org.apache.sling.api.resource.Resource)1