Skip to content

Commit 146aabb

Browse files
committed
Add test for onpop callback
1 parent 18f5874 commit 146aabb

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

cypress/integration/test.spec.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ describe('Integration Tests', () => {
2424
})
2525

2626
it('Can change duration', () => {
27-
cy.window()
28-
.invoke('toast.push', 'Test', { duration: 1000 })
29-
.get('._toastItem')
30-
.wait(1500)
31-
.should('not.exist')
27+
cy.window().invoke('toast.push', 'Test', { duration: 1000 }).get('._toastItem').wait(1500).should('not.exist')
3228
})
3329

3430
it('Can be non-dismissable then popped', () => {
@@ -94,7 +90,7 @@ describe('Integration Tests', () => {
9490
cy.get('[data-btn=changeDefaultColors]')
9591
.click()
9692
.get('._toastItem')
97-
.should('have.css', 'background-color', 'rgba(255, 255, 255, 0.95)')
93+
.should('have.css', 'background-color', 'rgba(245, 208, 254, 0.95)')
9894
.get('._toastBtn')
9995
.click()
10096
})
@@ -251,4 +247,18 @@ describe('Integration Tests', () => {
251247
})
252248
})
253249
})
250+
251+
it('Runs callback when toast is popped', () => {
252+
cy.get('[data-btn=runCallbackOnToastRemoval]')
253+
.click()
254+
.get('._toastItem')
255+
.contains('Wait for it')
256+
.get('._toastBtn')
257+
.click()
258+
.wait(500)
259+
.get('._toastItem')
260+
.contains('callback has been executed')
261+
.get('._toastBtn')
262+
.click()
263+
})
254264
})

0 commit comments

Comments
 (0)