Skip to content

Commit

Permalink
Check hidden class before removal
Browse files Browse the repository at this point in the history
  • Loading branch information
pkayokay committed Mar 22, 2024
1 parent a79be0e commit 2b62c10
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/alert_test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { aTimeout, fixture, expect } from '@open-wc/testing'
import { aTimeout, fixture, expect, nextFrame } from '@open-wc/testing'
import { fetchFixture } from './test_helpers'

import { Application } from '@hotwired/stimulus'
Expand All @@ -17,8 +17,8 @@ describe('AlertController', () => {
describe('with default values', () => {
it('shows the element immediately and closes it without delay ', async () => {
await loadFixture('alerts/alert_default.html')

expect(fetchElement().className.includes("hidden")).to.equal(false)

const closeButton = document.querySelector("[data-action='alert#close']")
closeButton.click()

Expand Down Expand Up @@ -55,6 +55,9 @@ describe('AlertController', () => {
const closeButton = document.querySelector("[data-action='alert#close']")
closeButton.click()

await aTimeout(100)
expect(fetchElement().className.includes("hidden")).to.equal(true)

await aTimeout(1100)
expect(fetchElement()).to.equal(null)
})
Expand Down

0 comments on commit 2b62c10

Please sign in to comment.