Skip to content

Commit

Permalink
test(components): fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverschuerch committed Sep 6, 2024
1 parent 2dd2915 commit 7027a43
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions packages/components/cypress/e2e/accordion.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,18 @@ describe('accordion', () => {
});

it('should propagate "postToggle" event from post-accordion-item on post-accordion', () => {
cy.document().then(document => {
const EventHandlerMock = cy.spy();
Cypress.$(document.querySelector('post-accordion')).on('postToggle', EventHandlerMock);
const EventHandlerMock = cy.spy();

cy.get('@collapsibles')
.last()
.click()
.then(() => {
expect(EventHandlerMock).to.be.calledTwice;
});
cy.get('@accordion').then($el => {
Cypress.$($el.get(0)).on('postToggle', EventHandlerMock);
});

cy.get('@collapsibles')
.last()
.click()
.then(() => {
expect(EventHandlerMock).to.be.calledTwice;
});
});
});

Expand Down

0 comments on commit 7027a43

Please sign in to comment.