Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
karlsnyder0 committed Jan 4, 2025
1 parent 13ca291 commit cc2a041
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ This will:
- install all dependencies if anything is missing
- build all the components, specially the ones needed for the docs
- start the docs website locally
- give you a link to open in your browser.
- give you a link to open in your browser. (http://localhost:5173/)

### Create a new component

Expand Down
20 changes: 14 additions & 6 deletions components/Accordion/assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function assertions(

cy.get('details summary').click()

cy.contains('Lorem ipsum, dolor sit amet').should('not.be.visible')
cy.get('details').should('not.have.attr', 'open')
})

it('displays a separator when separator:true', () => {
Expand Down Expand Up @@ -70,21 +70,29 @@ export default function assertions(
mountStory({ titleClassName: 'text-indigo-600' })

cy.get('details summary span')
.first()
.should('have.class', 'text-indigo-600')
.find('.text-indigo-600')
.should('exist')
.and('have.text', 'Accordion Title')
})

it('applies the descriptionClassName correctly', () => {
mountStory({ descriptionClassName: 'text-gray-500' })
mountStory({ descriptionClassName: 'text-gray-700' })

cy.get('details summary span').eq(1).should('have.class', 'text-gray-500')
cy.get('details summary')
.find('.text-gray-700')
.should('exist')
.and(
'have.text',
'Vestibulum id ligula porta felis euismod semper. Nulla vitae elit libero, a pharetra augue. Aenean lacinia bibendum nulla.',
)
})

it('does not toggle when locked', () => {
mountStory({ locked: true })

cy.get('details summary').click()

cy.contains('Lorem ipsum, dolor sit amet').should('not.be.visible')
cy.get('details').should('not.have.attr', 'open')
})

it('calls onClickSummary when summary is clicked', () => {
Expand Down

0 comments on commit cc2a041

Please sign in to comment.