@@ -3,7 +3,7 @@ import Undernet from "../src/index"
33// This is the starting DOM.
44// It is assigned to document.body.innerHTML before each test suite.
55const dom = `
6- <button href="#" data-modal-button ="new-modal">Open modal</button>
6+ <button data-target ="new-modal">Open modal</button>
77
88 <div className="modal-overlay" data-modal="new-modal">
99 <div className="modal-dialog" data-parent="new-modal" aria-labelledby="header-id">
@@ -86,7 +86,7 @@ describe("Modals", () => {
8686 document . body . innerHTML = dom
8787 Undernet . Modals . start ( )
8888 Undernet . Modals . stop ( )
89- button = document . querySelector ( "[data-modal-button ]" )
89+ button = document . querySelector ( "[data-target ]" )
9090 modalOverlay = document . querySelector ( "[data-modal]" )
9191 modalDialog = document . querySelector ( "[data-parent]" )
9292 button . click ( )
@@ -109,7 +109,7 @@ describe("Modals", () => {
109109 beforeAll ( ( ) => {
110110 document . body . innerHTML = dom
111111 Undernet . Modals . start ( )
112- button = document . querySelector ( "[data-modal-button ]" )
112+ button = document . querySelector ( "[data-target ]" )
113113 modalDialog = document . querySelector ( "[data-parent]" )
114114 modalOverlay = document . querySelector ( "[data-modal]" )
115115 button . click ( )
@@ -148,7 +148,7 @@ describe("Modals", () => {
148148 beforeAll ( ( ) => {
149149 document . body . innerHTML = dom
150150 Undernet . Modals . start ( )
151- openButton = document . querySelector ( "[data-modal-button ]" )
151+ openButton = document . querySelector ( "[data-target ]" )
152152 closeButton = document . querySelector ( "[data-close]" )
153153 modalOverlay = document . querySelector ( "[data-modal]" )
154154 modalDialog = document . querySelector ( "[data-parent]" )
@@ -175,7 +175,7 @@ describe("Modals", () => {
175175 } )
176176 } )
177177
178- it ( "sets focus to [data-modal-button ]" , ( ) => {
178+ it ( "sets focus to [data-target ]" , ( ) => {
179179 expect ( document . activeElement ) . toEqual ( openButton )
180180 } )
181181 } )
@@ -187,7 +187,7 @@ describe("Modals", () => {
187187 beforeAll ( ( ) => {
188188 document . body . innerHTML = dom
189189 Undernet . Modals . start ( )
190- button = document . querySelector ( "[data-modal-button ]" )
190+ button = document . querySelector ( "[data-target ]" )
191191 modalOverlay = document . querySelector ( "[data-modal]" )
192192 button . click ( )
193193 modalOverlay . click ( )
@@ -205,7 +205,7 @@ describe("Modals", () => {
205205 beforeAll ( ( ) => {
206206 document . body . innerHTML = dom
207207 Undernet . Modals . start ( )
208- button = document . querySelector ( "[data-modal-button ]" )
208+ button = document . querySelector ( "[data-target ]" )
209209 modalOverlay = document . querySelector ( "[data-modal]" )
210210 } )
211211
@@ -223,13 +223,13 @@ describe("Modals", () => {
223223 beforeAll ( ( ) => {
224224 document . body . innerHTML = dom
225225 Undernet . Modals . start ( )
226- openButton = document . querySelector ( "[data-modal-button ]" )
226+ openButton = document . querySelector ( "[data-target ]" )
227227 closeButton = document . querySelector ( "[data-close]" )
228228 openButton . click ( )
229229 closeButton . click ( )
230230 } )
231231
232- it ( "sets focus back to [data-modal-button ]" , ( ) => {
232+ it ( "sets focus back to [data-target ]" , ( ) => {
233233 expect ( document . activeElement ) . toEqual ( openButton )
234234 } )
235235 } )
@@ -241,7 +241,7 @@ describe("Modals", () => {
241241 beforeAll ( ( ) => {
242242 document . body . innerHTML = dom
243243 Undernet . Modals . start ( )
244- openButton = document . querySelector ( "[data-modal-button ]" )
244+ openButton = document . querySelector ( "[data-target ]" )
245245 closeButton = document . querySelector ( "[data-close]" )
246246 openButton . click ( )
247247 closeButton . click ( )
@@ -258,7 +258,7 @@ describe("Modals", () => {
258258 beforeAll ( ( ) => {
259259 document . body . innerHTML = dom
260260 Undernet . Modals . start ( )
261- button = document . querySelector ( "[data-modal-button ]" )
261+ button = document . querySelector ( "[data-target ]" )
262262 button . click ( )
263263 } )
264264
0 commit comments