use of com.adobe.cq.wcm.core.components.models.Title in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ComponentDataImplTest method getDataLayerJsonWhenDataLayerEnabled.
@Test
void getDataLayerJsonWhenDataLayerEnabled() {
Title title = getTitleUnderTest(TITLE_RESOURCE_JCR_TITLE, true);
assertNotNull(title.getData());
String expected = "{\"title-7968bee19c\":{\"@type\":\"core/wcm/components/title/v1/title\",\"dc:title\":\"Hello World\",\"repo:modifyDate\":\"2016-01-13T15:14:51Z\"}}";
assertEquals(Json.createReader(new StringReader(expected)).read(), Json.createReader(new StringReader(title.getData().getJson())).read());
Utils.testJSONExport(title, Utils.getTestExporterJSONPath(TEST_BASE, 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 ComponentDataImplTest method getDataLayerJsonWhenDataLayerDisabled.
@Test
void getDataLayerJsonWhenDataLayerDisabled() {
Title title = getTitleUnderTest(TITLE_RESOURCE_JCR_TITLE, false);
assertNull(title.getData());
}
use of com.adobe.cq.wcm.core.components.models.Title in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class TitleImplTest method testGetTitleFromCurrentPageWithWrongElementInfo.
@Test
protected void testGetTitleFromCurrentPageWithWrongElementInfo() {
Title title = getTitleUnderTest(TITLE_WRONGTYPE);
assertNull(title.getType());
Utils.testJSONExport(title, Utils.getTestExporterJSONPath(testBase, TITLE_WRONGTYPE));
}
use of com.adobe.cq.wcm.core.components.models.Title in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class TitleImplTest method testV2JSONExport.
@Test
@SuppressWarnings("deprecation")
protected void testV2JSONExport() {
Title title = getTitleUnderTest(TITLE_RESOURCE_JCR_TITLE_V2);
assertNull(title.getLinkURL());
Utils.testJSONExport(title, Utils.getTestExporterJSONPath(testBase, TITLE_RESOURCE_JCR_TITLE_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 testGetTitleFromResourceWithElementInfo.
@Test
protected void testGetTitleFromResourceWithElementInfo() {
Title title = getTitleUnderTest(TITLE_RESOURCE_JCR_TITLE_TYPE);
assertEquals("Hello World", title.getText());
assertEquals("h2", title.getType());
Utils.testJSONExport(title, Utils.getTestExporterJSONPath(testBase, TITLE_RESOURCE_JCR_TITLE_TYPE));
}
Aggregations