$this->
assertClass($elements[2
], 'pager__item', 'Element for page 3 has .pager__item class.'
);
$this->
assertNotEmpty($elements[2
]->
find('css', 'a'
), 'Link to page 3 found.'
);
$this->
assertClass($elements[3
], 'pager__item--next', 'Element for next page has .pager__item--next class.'
);
$this->
assertNotEmpty($elements[3
]->
find('css', 'a'
), 'Link to next page found.'
);
$this->
assertClass($elements[4
], 'pager__item--last', 'Element for last page has .pager__item--last class.'
);
$this->
assertNotEmpty($elements[4
]->
find('css', 'a'
), 'Link to last page found.'
);
// Navigate to next page.
$element =
$this->
assertSession()->
elementExists('xpath', '//li[contains(@class, "pager__item--next")]/a'
);
$this->
clickPreviewLinkAJAX($element, 5
);
// Test that the pager is present and rendered.
$elements =
$this->
xpath('//ul[contains(@class, "pager__items")]/li'
);
$this->
assertNotEmpty($elements);
// Verify elements and links to pages.
// We expect to find 7 elements: links to '<< first' and '< previous'
// pages, link to page 1, current page == 2, link to page 3 and links
// to 'next >' and 'last >>' pages.
$this->
assertClass($elements[0
], 'pager__item--first', 'Element for first page has .pager__item--first class.'
);
$this->
assertNotEmpty($elements[0
]->
find('css', 'a'
), 'Link to first page found.'
);