Search in sources :

Example 1 with BreadcrumbElement

use of org.xwiki.test.ui.po.BreadcrumbElement in project xwiki-platform by xwiki.

the class CreatePageNestedDocumentsTest method assertCreatedNestedDocument.

private void assertCreatedNestedDocument(DocumentReference pageReference, ViewPage viewPage) {
    SpaceReference spaceReference = pageReference.getLastSpaceReference();
    BreadcrumbElement breadcrumb = viewPage.getBreadcrumb();
    if (breadcrumb.canBeExpanded()) {
        breadcrumb.expand();
    }
    assertEquals("/" + getUtil().getURLFragment(spaceReference), breadcrumb.getPathAsString());
    assertEquals(spaceReference.getName(), viewPage.getDocumentTitle());
    assertEquals(getUtil().serializeReference(pageReference), viewPage.getMetaDataValue("reference"));
}
Also used : SpaceReference(org.xwiki.model.reference.SpaceReference) BreadcrumbElement(org.xwiki.test.ui.po.BreadcrumbElement)

Example 2 with BreadcrumbElement

use of org.xwiki.test.ui.po.BreadcrumbElement in project xwiki-platform by xwiki.

the class BreadcrumbsTest method verifyBreadcrumbInLongHierarchy.

@Test
public void verifyBreadcrumbInLongHierarchy() throws Exception {
    DocumentReference documentReference = new DocumentReference("xwiki", Arrays.asList("A", "B", "C", "D", "E", "F", "G", "H"), "WebHome");
    ViewPage page = getUtil().createPage(documentReference, "Content", getTestMethodName());
    BreadcrumbElement breadcrumb = page.getBreadcrumb();
    // Verify that the breadcrumb is limited
    assertEquals("/A/…/F/G/" + getTestMethodName(), breadcrumb.getPathAsString());
    // Verify we can expand it
    breadcrumb.expand();
    assertEquals("/A/B/C/D/E/F/G/" + getTestMethodName(), breadcrumb.getPathAsString());
    // Clean
    getUtil().deletePage(documentReference);
}
Also used : ViewPage(org.xwiki.test.ui.po.ViewPage) DocumentReference(org.xwiki.model.reference.DocumentReference) BreadcrumbElement(org.xwiki.test.ui.po.BreadcrumbElement) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Aggregations

BreadcrumbElement (org.xwiki.test.ui.po.BreadcrumbElement)2 Test (org.junit.Test)1 DocumentReference (org.xwiki.model.reference.DocumentReference)1 SpaceReference (org.xwiki.model.reference.SpaceReference)1 AbstractTest (org.xwiki.test.ui.AbstractTest)1 ViewPage (org.xwiki.test.ui.po.ViewPage)1