def test_deep_middle_page(self): page = self.page(5, 9) out = pagination_control(self.mock_context('/test'), page) expected_spacer = ( '<li class="disabled"><span aria-hidden="true">…</span>' '</li>') self.assertInHTML(expected_spacer, out)
def test_deep_middle_page(self): page = self.page(5, 9) out = pagination_control(None, page, '/test') expected_spacer = ( '<li class="disabled"><span aria-hidden="true">…</span>' '</li>') self.assertInHTML(expected_spacer, out)
def test_middle_page(self): page = self.page(2, 3) out = pagination_control(self.mock_context('/test'), page) expected_prev = ('<li><a href="/test" aria-label="Previous">' '<span aria-hidden="true">«</span></a></li>') expected_next = ('<li><a href="/test?page=3" aria-label="Next">' '<span aria-hidden="true">»</span></a></li>') self.assertInHTML(expected_prev, out) self.assertInHTML(expected_next, out)
def test_last_page(self): page = self.page(3, 3) out = pagination_control(self.mock_context('/test'), page) expected_prev = ('<li><a href="/test?page=2" aria-label="Previous">' '<span aria-hidden="true">«</span></a></li>') expected_next = ( '<li class="disabled"><span aria-hidden="true">»</span>' '</li>') self.assertInHTML(expected_prev, out) self.assertInHTML(expected_next, out)
def test_middle_page(self): page = self.page(2, 3) out = pagination_control(None, page, '/test') expected_prev = ( '<li><a href="/test" aria-label="Previous">' '<span aria-hidden="true">«</span></a></li>') expected_next = ( '<li><a href="/test?page=3" aria-label="Next">' '<span aria-hidden="true">»</span></a></li>') self.assertInHTML(expected_prev, out) self.assertInHTML(expected_next, out)
def test_first_page(self): page = self.page(1, 3) out = pagination_control(None, page, '/test') expected_prev = ( '<li class="disabled"><span aria-hidden="true">«</span>' '</li>') expected_next = ( '<li><a href="/test?page=2" aria-label="Next">' '<span aria-hidden="true">»</span></a></li>') self.assertInHTML(expected_prev, out) self.assertInHTML(expected_next, out)
def test_last_page(self): page = self.page(3, 3) out = pagination_control(self.mock_context('/test'), page) expected_prev = ( '<li><a href="/test?page=2" aria-label="Previous">' '<span aria-hidden="true">«</span></a></li>') expected_next = ( '<li class="disabled"><span aria-hidden="true">»</span>' '</li>') self.assertInHTML(expected_prev, out) self.assertInHTML(expected_next, out)
def test_one_page(self): page = self.page(1, 1) out = pagination_control(self.mock_context('/test'), page) self.assertEqual("", out)
def test_one_page(self): page = self.page(1, 1) out = pagination_control(None, page, '/test') self.assertEqual("", out)