diff --git a/test/fixtures/slideover.html b/test/fixtures/slideover.html index 5ad242f..a37dc09 100644 --- a/test/fixtures/slideover.html +++ b/test/fixtures/slideover.html @@ -1,48 +1,7 @@ -
- - - - - -

Tailwind Stimulus Components Examples

- -
-

Slideovers

- -
+
+ +

This slideover dialog has a groovy backdrop!

+ +
+
diff --git a/test/slideover_test.js b/test/slideover_test.js index 1c7f5b6..a63e136 100644 --- a/test/slideover_test.js +++ b/test/slideover_test.js @@ -14,21 +14,11 @@ describe('SlideoverController', () => { application.register('slideover', Slideover) }) - it('applies visible class to target ', () => { - const mobileSidebar = document.querySelector('#sidebar-mobile') - const invisibleClass = document.querySelector('[data-controller="slideover"]').dataset - .slideoverInvisibleClass - const visibleClass = document.querySelector('[data-controller="slideover"]').dataset - .slideoverVisibleClass - - const overLayTarget = mobileSidebar.querySelector('[data-slideover-target="overlay"]') - const actionBtn = document.querySelector( - '[data-action="click->slideover#toggle click@window->slideover#hide"]', - ) - - expect(overLayTarget.className.includes('hidden')).to.equal(true) - actionBtn.click() - expect(overLayTarget.className.includes(visibleClass)).to.equal(false) + it('opens dialog', () => { + const dialog = document.querySelector("dialog") + expect(dialog.hasAttribute("open")).to.equal(false) + document.querySelector("[data-action='slideover#open']").click() + expect(dialog.hasAttribute("open")).to.equal(true) }) }) })