From 2b62c10180b63ccf253ec0bafd8515fc8efc9c3a Mon Sep 17 00:00:00 2001 From: Paul Kim Date: Thu, 21 Mar 2024 22:57:31 -0400 Subject: [PATCH] Check hidden class before removal --- test/alert_test.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/alert_test.js b/test/alert_test.js index fb0857d..59d0dc9 100644 --- a/test/alert_test.js +++ b/test/alert_test.js @@ -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' @@ -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() @@ -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) })