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());
}
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));
}
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));
}
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));
}
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));
}
Aggregations