Skip to content

Commit

Permalink
Refactor assertFieldTextarea to include the word count
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgain committed Jan 23, 2024
1 parent b3d0a53 commit 678d5ee
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/functional/cypress/support/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,8 @@ const assertFieldInputNoLabel = ({ element, value = undefined }) =>
const assertFieldHidden = ({ element, name, value }) =>
cy.wrap(element).should('have.attr', 'name', name).should('have.value', value)

const assertFieldTextarea = ({ element, label, hint, value, wordCount }) =>
cy
.wrap(element)
const assertFieldTextarea = ({ element, label, hint, value, wordCount }) => {
cy.wrap(element)
.find('label')
.should('contain', label)
.parent()
Expand All @@ -430,9 +429,9 @@ const assertFieldTextarea = ({ element, label, hint, value, wordCount }) =>
.parent()
.find('textarea')
.then(($el) => value ?? cy.wrap($el).should('have.text', value || ''))
.parent()
.find('p')
.then(($el) => wordCount && cy.wrap($el).should('have.text', wordCount))

wordCount && cy.wrap(element).find('p').should('have.text', wordCount)
}

const assertFieldTextareaNoLabel = ({ element, value = undefined }) =>
cy
Expand Down

0 comments on commit 678d5ee

Please sign in to comment.