Skip to content

Commit

Permalink
Merge pull request #7180 from uktrade/fix/rename-pagination-controls
Browse files Browse the repository at this point in the history
Rename previous and next to previous page and next page
  • Loading branch information
paulgain authored Sep 24, 2024
2 parents 57508a9 + 50aa2fa commit 322a5a6
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 39 deletions.
4 changes: 2 additions & 2 deletions src/client/components/Pagination/constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const PAGINATION_PIECE_PREVIOUS = 'Previous'
export const PAGINATION_PIECE_PREVIOUS = 'Previous page'
export const PAGINATION_PIECE_ELLIPSIS = 'ellipsis'
export const PAGINATION_PIECE_PAGE_NUMBER = 'page-number'
export const PAGINATION_PIECE_NEXT = 'Next'
export const PAGINATION_PIECE_NEXT = 'Next page'

export const DEFAULT_MAX_PAGE_NUMBER_LINKS = 5
4 changes: 2 additions & 2 deletions src/client/components/Pagination/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function Pagination({
onClick={onClick}
href={getPageUrl(pageNumber)}
>
Previous
Previous page
</StyledPaginationLink>
)}

Expand Down Expand Up @@ -141,7 +141,7 @@ function Pagination({
onClick={onClick}
href={getPageUrl(pageNumber)}
>
Next
Next page
</StyledPaginationLink>
)}
</StyledPaginationPiece>
Expand Down
4 changes: 2 additions & 2 deletions src/templates/_macros/common/pagination.njk
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
aria-label="pagination: total {{ pagination.totalPages }} pages"
>
{% if pagination.prev -%}
<a href="{{ pagination.prev }}" class="c-pagination__label c-pagination__label--prev">Previous</a>
<a href="{{ pagination.prev }}" class="c-pagination__label c-pagination__label--prev">Previous page</a>
{%- endif %}
{% if showPages -%}
<ul class="c-pagination__list">
Expand All @@ -47,7 +47,7 @@
</ul>
{%- endif %}
{% if pagination.next -%}
<a href="{{ pagination.next }}" class="c-pagination__label c-pagination__label--next">Next</a>
<a href="{{ pagination.next }}" class="c-pagination__label c-pagination__label--next">Next page</a>
{%- endif %}
</nav>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion test/component/cypress/specs/Resource/Paginated.cy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe.skip('Resource/Paginated', () => {
cy.get('@page').should('have.text', JSON.stringify(page))
})

// Go through pages backwards by clicking Previous
// Go through pages backwards by clicking Previous page
PAGES.slice(0, -1)
.toReversed()
.forEach((page) => {
Expand Down
34 changes: 17 additions & 17 deletions test/component/cypress/specs/components/Pagination.cy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Pagination', () => {
cy.mount(<Component items={150} />)
})
it('should render a page link', () => {
assertVisiblePageLinks(['Next'])
assertVisiblePageLinks(['Next page'])
})
})
context('when on MOBILE and you click next', () => {
Expand All @@ -56,7 +56,7 @@ describe('Pagination', () => {
cy.get('[data-test="pagination"] ul li a').last().click()
})
it('should render two page links', () => {
assertVisiblePageLinks(['Previous', 'Next'])
assertVisiblePageLinks(['Previous page', 'Next page'])
})
it('should have an active page link', () => {
assertActivePageLink('next')
Expand All @@ -77,7 +77,7 @@ describe('Pagination', () => {
cy.get('[data-test="pagination"] ul li a').first().click()
})
it('should render two page links', () => {
assertVisiblePageLinks(['Previous', 'Next'])
assertVisiblePageLinks(['Previous page', 'Next page'])
})
it('should have an active page link', () => {
assertActivePageLink('previous')
Expand All @@ -94,7 +94,7 @@ describe('Pagination', () => {
cy.mount(<Component items={150} initialPage={15} />)
})
it('should render one page link', () => {
assertVisiblePageLinks(['Previous'])
assertVisiblePageLinks(['Previous page'])
})
})
context('when on MOBILE and you only have one page', () => {
Expand Down Expand Up @@ -122,7 +122,7 @@ describe('Pagination', () => {
'8',
'9',
'10',
'Next',
'Next page',
])
})
it('should have an active page link', () => {
Expand All @@ -135,7 +135,7 @@ describe('Pagination', () => {
cy.mount(<Component items={15} />)
})
it('should render page links', () => {
assertPageLinks(['1', '2', 'Next'])
assertPageLinks(['1', '2', 'Next page'])
})
it('should have an active page link', () => {
assertActivePageLink(1)
Expand All @@ -149,7 +149,7 @@ describe('Pagination', () => {
})
it('should render page links', () => {
assertPageLinks([
'Previous',
'Previous page',
'1',
'2',
'3',
Expand All @@ -160,7 +160,7 @@ describe('Pagination', () => {
'8',
'9',
'10',
'Next',
'Next page',
])
})
it('should have an active page link', () => {
Expand All @@ -173,15 +173,15 @@ describe('Pagination', () => {
cy.window().its('scrollY').should('equal', 0)
})
})
context('when you navigate to page 2 by clicking the Next link', () => {
context('when you navigate to page 2 by clicking the next page link', () => {
beforeEach(() => {
cy.viewport(1000, 1000)
cy.mount(<Component items={1000} />)
cy.get('[data-test="pagination"] ul li a').last().click()
})
it('should render page links', () => {
assertPageLinks([
'Previous',
'Previous page',
'1',
'2',
'3',
Expand All @@ -192,7 +192,7 @@ describe('Pagination', () => {
'8',
'9',
'10',
'Next',
'Next page',
])
})
it('should have an active page link', () => {
Expand Down Expand Up @@ -226,7 +226,7 @@ describe('Pagination', () => {
'8',
'9',
'10',
'Next',
'Next page',
])
})
it('should have an active page link', () => {
Expand All @@ -248,7 +248,7 @@ describe('Pagination', () => {
})
it('should display the next 10 page links', () => {
assertPageLinks([
'Previous',
'Previous page',
'2',
'3',
'4',
Expand All @@ -259,7 +259,7 @@ describe('Pagination', () => {
'9',
'10',
'11',
'Next',
'Next page',
])
})
})
Expand All @@ -270,7 +270,7 @@ describe('Pagination', () => {
})
it('should render page links', () => {
assertPageLinks([
'Previous',
'Previous page',
'1',
'2',
'3',
Expand All @@ -281,7 +281,7 @@ describe('Pagination', () => {
'8',
'9',
'10',
'Next',
'Next page',
])
})
it('should have an active page link', () => {
Expand All @@ -296,7 +296,7 @@ describe('Pagination', () => {
})
it('should render page links', () => {
assertPageLinks([
'Previous',
'Previous page',
'1',
'2',
'3',
Expand Down
10 changes: 5 additions & 5 deletions test/functional/cypress/specs/companies/export/history-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ describe('Company Export tab - Export countries history', () => {
])
})

it('should display the next button', () => {
cy.get('[data-test="next"]').should('have.text', 'Next')
it('should display the next page button', () => {
cy.get('[data-test="next"]').should('have.text', 'Next page')
})

it('should not display the previous button', () => {
Expand All @@ -151,14 +151,14 @@ describe('Company Export tab - Export countries history', () => {
])
})

it('should not display the next button', () => {
it('should not display the next page button', () => {
cy.get('[aria-label="Page 2"]').click()
cy.get('[data-test="next"]').should('not.exist')
})

it('should display the previous button', () => {
it('should display the previous page button', () => {
cy.get('[aria-label="Page 2"]').click()
cy.get('[data-test="prev"]').should('have.text', 'Previous')
cy.get('[data-test="prev"]').should('have.text', 'Previous page')
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ describe('Exports New Interaction Reminders', () => {
cy.get('@paginationItems').eq(0).should('have.text', '1')
cy.get('@paginationItems').eq(1).should('have.text', '2')
cy.get('@paginationItems').eq(2).should('have.text', '3')
cy.get('@paginationItems').eq(3).should('have.text', 'Next')
cy.get('@paginationItems').eq(3).should('have.text', 'Next page')
})

it('should navigate to another page when clicked', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ describe('Exports no recent Interaction Reminders', () => {
cy.get('@paginationItems').eq(0).should('have.text', '1')
cy.get('@paginationItems').eq(1).should('have.text', '2')
cy.get('@paginationItems').eq(2).should('have.text', '3')
cy.get('@paginationItems').eq(3).should('have.text', 'Next')
cy.get('@paginationItems').eq(3).should('have.text', 'Next page')
})

it('should navigate to another page when clicked', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ describe('Estimated Land Date Reminders', () => {
cy.get('@paginationItems').eq(0).should('have.text', '1')
cy.get('@paginationItems').eq(1).should('have.text', '2')
cy.get('@paginationItems').eq(2).should('have.text', '3')
cy.get('@paginationItems').eq(3).should('have.text', 'Next')
cy.get('@paginationItems').eq(3).should('have.text', 'Next page')
})

it('should navigate to another page when clicked', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ describe('No Recent Interaction Reminders', () => {
cy.get('@paginationItems').eq(0).should('have.text', '1')
cy.get('@paginationItems').eq(1).should('have.text', '2')
cy.get('@paginationItems').eq(2).should('have.text', '3')
cy.get('@paginationItems').eq(3).should('have.text', 'Next')
cy.get('@paginationItems').eq(3).should('have.text', 'Next page')
})

it('should navigate to another page when clicked', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe('Outstanding Proposition Reminders', () => {
.as('paginationItems')
cy.get('@paginationItems').eq(0).should('have.text', '1')
cy.get('@paginationItems').eq(1).should('have.text', '2')
cy.get('@paginationItems').eq(2).should('have.text', 'Next')
cy.get('@paginationItems').eq(2).should('have.text', 'Next page')
})

it('should navigate to another page when clicked', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ describe('My Tasks Due Date Approaching Reminders', () => {
cy.get('@paginationItems').eq(0).should('have.text', '1')
cy.get('@paginationItems').eq(1).should('have.text', '2')
cy.get('@paginationItems').eq(2).should('have.text', '3')
cy.get('@paginationItems').eq(3).should('have.text', 'Next')
cy.get('@paginationItems').eq(3).should('have.text', 'Next page')
})

it('should navigate to another page when clicked', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('My Tasks Task Overdue Reminders', () => {
cy.get('@paginationItems').eq(0).should('have.text', '1')
cy.get('@paginationItems').eq(1).should('have.text', '2')
cy.get('@paginationItems').eq(2).should('have.text', '3')
cy.get('@paginationItems').eq(3).should('have.text', 'Next')
cy.get('@paginationItems').eq(3).should('have.text', 'Next page')
})

it('should navigate to another page when clicked', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe('Task Amended By Others Reminders', () => {
cy.get('@paginationItems').eq(0).should('have.text', '1')
cy.get('@paginationItems').eq(1).should('have.text', '2')
cy.get('@paginationItems').eq(2).should('have.text', '3')
cy.get('@paginationItems').eq(3).should('have.text', 'Next')
cy.get('@paginationItems').eq(3).should('have.text', 'Next page')
})

it('should navigate to another page when clicked', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe('My Tasks Task Assigned To Me From Others Reminders', () => {
cy.get('@paginationItems').eq(0).should('have.text', '1')
cy.get('@paginationItems').eq(1).should('have.text', '2')
cy.get('@paginationItems').eq(2).should('have.text', '3')
cy.get('@paginationItems').eq(3).should('have.text', 'Next')
cy.get('@paginationItems').eq(3).should('have.text', 'Next page')
})

it('should navigate to another page when clicked', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('My Tasks Task Completed Reminders', () => {
cy.get('@paginationItems').eq(0).should('have.text', '1')
cy.get('@paginationItems').eq(1).should('have.text', '2')
cy.get('@paginationItems').eq(2).should('have.text', '3')
cy.get('@paginationItems').eq(3).should('have.text', 'Next')
cy.get('@paginationItems').eq(3).should('have.text', 'Next page')
})

it('should navigate to another page when clicked', () => {
Expand Down

0 comments on commit 322a5a6

Please sign in to comment.