Skip to content

Commit

Permalink
Added test to check document category is displayed in tag page and no…
Browse files Browse the repository at this point in the history
…t principle/standard/pattern pages
  • Loading branch information
keithkennedyHO committed Nov 6, 2023
1 parent fed00b1 commit bd7130d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _includes/macros/contentDocumentList.njk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{% if item.data.date or item.data.tags %}
<ul class="app-document-list__item-metadata">
{% if params.displayContentCategory === true and item.data.category %}
<li class="app-document-list__attribute">
<li class="app-document-list__attribute document-category">
{{ item.data.category }}
</li>
{% endif %}
Expand Down
32 changes: 32 additions & 0 deletions cypress/e2e/spec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,35 @@ describe('Pagination links respect path prefix', () => {
cy.contains('h1', 'Principles')
})
})

describe('Content category displays in correct listing pages', () => {
it('finds the content category in tag page', () => {
cy.visit(testing_params.TEST_ROOT_URL + '/tags/ways-of-working/')
cy.get('ol.app-document-list').find('.document-category')
.its('length').should('be.gte', 5)
})

it('does not find the content category in principles page', () => {
cy.visit(testing_params.TEST_ROOT_URL)
cy.contains('Read our principles').click()
// No .document-category listed in this page
cy.get('ol.app-document-list').find('.document-category')
.should('have.length', 0)
})

it('does not find the content category in standards page', () => {
cy.visit(testing_params.TEST_ROOT_URL)
cy.contains('Read our standards').click()
// No .document-category listed in this page
cy.get('ol.app-document-list').find('.document-category')
.should('have.length', 0)
})

it('does not find the content category in patterns page', () => {
cy.visit(testing_params.TEST_ROOT_URL)
cy.contains('Read our patterns').click()
// No .document-category listed in this page
cy.get('ol.app-document-list').find('.document-category')
.should('have.length', 0)
})
})

0 comments on commit bd7130d

Please sign in to comment.