use of com.adobe.cq.wcm.core.components.models.ListItem in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class TeaserImplTest method testTeaserWithActions.
@Test
protected void testTeaserWithActions() {
Teaser teaser = getTeaserUnderTest(TEASER_7);
assertTrue(teaser.isActionsEnabled(), "Expected teaser with actions");
assertEquals(2, teaser.getActions().size(), "Expected to find two actions");
ListItem action = teaser.getActions().get(0);
assertEquals("http://www.adobe.com", action.getPath(), "Action link does not match");
assertEquals("Adobe", action.getTitle(), "Action text does not match");
Utils.testJSONExport(teaser, Utils.getTestExporterJSONPath(testBase, "teaser9"));
}
use of com.adobe.cq.wcm.core.components.models.ListItem in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class TeaserImplTest method testTeaserWithTitleFromLinkedPageAndActions.
@Test
void testTeaserWithTitleFromLinkedPageAndActions() {
Teaser teaser = getTeaserUnderTest(TEASER_12);
assertEquals("Adobe", teaser.getTitle());
List<ListItem> actions = teaser.getActions();
assertEquals("http://www.adobe.com", actions.get(0).getPath());
assertEquals("Adobe", actions.get(0).getTitle());
}
use of com.adobe.cq.wcm.core.components.models.ListItem in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class LayoutContainerImplTest method verifyContainerItems.
private void verifyContainerItems(Object[][] expectedItems, List<ListItem> items) {
assertEquals(expectedItems.length, items.size(), "Item number mismatch");
int index = 0;
for (ListItem item : items) {
assertEquals(expectedItems[index][1], item.getTitle(), "Item title mismatch");
index++;
}
}
use of com.adobe.cq.wcm.core.components.models.ListItem in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class TeaserImplTest method testTeaserWithTitleNotFromLinkedPageAndActions.
@Test
void testTeaserWithTitleNotFromLinkedPageAndActions() {
Teaser teaser = getTeaserUnderTest(TEASER_11);
assertEquals("Teaser", teaser.getTitle());
List<ListItem> actions = teaser.getActions();
assertEquals("http://www.adobe.com", actions.get(0).getPath());
assertEquals("Adobe", actions.get(0).getTitle());
assertEquals("/content/teasers", actions.get(1).getPath());
assertEquals("Teasers", actions.get(1).getTitle());
}
use of com.adobe.cq.wcm.core.components.models.ListItem in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ListImplTest method testListRenderedAsTeaserItems.
@Test
protected void testListRenderedAsTeaserItems() {
List list = getListUnderTest(LIST_20);
assertEquals(3, list.getListItems().size());
Collection<ListItem> items = list.getListItems();
// The featured image of the page exists: the featured image node of the page is used to render the teaser item
ListItem item0 = (ListItem) items.toArray()[0];
Resource teaserResource0 = item0.getTeaserResource();
ValueMap teaserProperties = teaserResource0.getValueMap();
String linkURL = teaserProperties.get("linkURL", String.class);
String fileReference = teaserProperties.get("fileReference", String.class);
String title = teaserProperties.get("jcr:title", String.class);
String description = teaserProperties.get("jcr:description", String.class);
assertEquals("/content/list/pages/page_1/page_1_1/jcr:content/cq:featuredimage", teaserResource0.getPath(), "image resource: path");
assertEquals("core/wcm/components/teaser/v2/teaser", teaserResource0.getResourceType(), "image resource: resource type");
assertEquals("/content/list/pages/page_1/page_1_1", linkURL, "image resource: linkURL");
assertEquals("/content/dam/core/images/Adobe_Systems_logo_and_wordmark.png", fileReference, "image resource: fileReference");
assertEquals("Page 1.1", title, "image resource: title");
assertEquals("Description for Page 1.1", description, "image resource: description");
// The featured image of the page does not exist: the content node of the page is used to render the teaser item
ListItem item2 = (ListItem) items.toArray()[2];
Resource teaserResource2 = item2.getTeaserResource();
assertEquals("/content/list/pages/page_1/page_1_3/jcr:content", teaserResource2.getPath(), "image resource: path");
Utils.testJSONExport(list, Utils.getTestExporterJSONPath(testBase, LIST_20));
}
Aggregations