use of com.adobe.cq.wcm.core.components.models.NavigationItem in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class BreadcrumbImpl method addNavigationItems.
private void addNavigationItems(int currentLevel) {
while (startLevel < currentLevel) {
Page page = currentPage.getAbsoluteParent(startLevel);
if (page != null) {
boolean isActivePage = page.equals(currentPage);
if (isActivePage && hideCurrent) {
break;
}
if (checkIfNotHidden(page)) {
NavigationItem navigationItem = new NavigationItemImpl(page, isActivePage);
items.add(navigationItem);
}
}
startLevel++;
}
}
use of com.adobe.cq.wcm.core.components.models.NavigationItem in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class LanguageNavigationImplTest method testLanguageNavigationItemsOnTemplate.
@Test
protected void testLanguageNavigationItemsOnTemplate() {
LanguageNavigation languageNavigation = getLanguageNavigationUnderTest("/conf/coretest/settings/wcm/templates/template-1/structure/jcr:content/root/languagenavigation");
List<NavigationItem> items = getLanguageNavigationItems(languageNavigation);
Object[][] expectedPages = { { "/content/languagenavigation/LOCALE-1", "LOCALE 1", false, 0, "US", "en-US", "/content/languagenavigation/LOCALE-1.html" }, { "/content/languagenavigation/LOCALE-1/LOCALE-5", "LOCALE 5", false, 1, "US", "en-US", "/content/languagenavigation/LOCALE-1/LOCALE-5.html" }, { "/content/languagenavigation/LOCALE-1/LOCALE-6", "LOCALE 6", false, 1, "US", "es-US", "/content/languagenavigation/LOCALE-1/LOCALE-6.html" }, { "/content/languagenavigation/LOCALE-2", "LOCALE 2", false, 0, "CA", "en-CA", "/content/languagenavigation/LOCALE-2.html" }, { "/content/languagenavigation/LOCALE-2/LOCALE-5", "LOCALE 5", false, 1, "CA", "en-CA", "/content/languagenavigation/LOCALE-2/LOCALE-5.html" }, { "/content/languagenavigation/LOCALE-2/LOCALE-7", "LOCALE 7", false, 1, "CA", "fr-CA", "/content/languagenavigation/LOCALE-2/LOCALE-7.html" }, { "/content/languagenavigation/LOCALE-3", "LOCALE 3", false, 0, "CH", "de-CH", "/LOCALE-3-vanity" }, { "/content/languagenavigation/LOCALE-3/LOCALE-8", "LOCALE 8", false, 1, "CH", "de-CH", "/content/languagenavigation/LOCALE-3/LOCALE-8.html" }, { "/content/languagenavigation/LOCALE-4", "LOCALE 4", false, 0, "DE", "de-DE", "/content/languagenavigation/LOCALE-4.html" }, { "/content/languagenavigation/LOCALE-4/LOCALE-9", "LOCALE 9", false, 1, "DE", "de-DE", "/content/languagenavigation/LOCALE-4/LOCALE-9.html" } };
verifyLanguageNavigationItems(expectedPages, items);
}
use of com.adobe.cq.wcm.core.components.models.NavigationItem in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class PageImplTest method testRedirectTarget.
@Test
@SuppressWarnings("deprecation")
protected void testRedirectTarget() {
Page page = getPageUnderTest(REDIRECT_PAGE);
loadHtmlPageItemsConfig(true);
NavigationItem redirectTarget = page.getRedirectTarget();
assertNotNull(redirectTarget);
assertEquals("Templated Page", redirectTarget.getPage().getTitle());
assertEquals("/core/content/page/templated-page.html", redirectTarget.getURL());
}
use of com.adobe.cq.wcm.core.components.models.NavigationItem in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class BreadcrumbImplTest method checkBreadcrumbConsistency.
private void checkBreadcrumbConsistency(String[] expectedPages) {
assertTrue("Expected that the returned breadcrumb will contain " + expectedPages.length + " items", underTest.getItems().size() == expectedPages.length);
int index = 0;
for (NavigationItem item : underTest.getItems()) {
assertEquals(expectedPages[index++], item.getPage().getTitle());
}
}
use of com.adobe.cq.wcm.core.components.models.NavigationItem in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class PageImplTest method testRedirectTarget.
@Test
@SuppressWarnings("deprecation")
@Override
protected void testRedirectTarget() {
Page page = getPageUnderTest(REDIRECT_PAGE);
NavigationItem redirectTarget = page.getRedirectTarget();
assertNotNull(redirectTarget);
assertEquals("Templated Page", redirectTarget.getPage().getTitle());
assertEquals("/core/content/page/templated-page.html", redirectTarget.getURL());
assertValidLink(redirectTarget.getLink(), "/content/page/templated-page.html", context.request());
}
Aggregations