@@ -131,8 +131,20 @@ assert.equal(new __helpers.CSSHelp(document).getStyle(".lightbox")?.position, "f
131131Your ` .lightbox` element should cover the entire viewport.
132132
133133` ` ` js
134- assert.equal(new __helpers.CSSHelp(document).getStyle(".lightbox")?.width, "100%");
135- assert.equal(new __helpers.CSSHelp(document).getStyle(".lightbox")?.height, "100%");
134+ const style = new __helpers.CSSHelp(document).getStyle(".lightbox");
135+
136+ const width = style?.width;
137+ const height = style?.height;
138+
139+ assert.oneOf(
140+ width,
141+ ["100%", "100vw"]
142+ );
143+
144+ assert.oneOf(
145+ height,
146+ ["100%", "100vh"]
147+ );
136148` ` `
137149
138150Your ` .lightbox` element should be aligned with top left corner of the container.
@@ -197,15 +209,18 @@ When your `.lightbox` element is visible and you click the `#close-btn` button,
197209
198210` ` ` js
199211const lightbox = document.querySelector(".lightbox");
200- const background = document.getElementById("close-btn");
212+ const closeBtn = document.getElementById("close-btn");
213+ const galleryItem = document.querySelector(".gallery-item");
201214
202215function getComputedDisplay(element) {
203216 return window.getComputedStyle(element).display;
204217}
205218
206- lightbox.style.display = "flex" ;
219+ galleryItem.dispatchEvent(new Event("click", { bubbles: true })) ;
207220
208- background.dispatchEvent(new Event("click"));
221+ assert.strictEqual(getComputedDisplay(lightbox), "flex");
222+
223+ closeBtn.dispatchEvent(new Event("click", { bubbles: true }));
209224
210225assert.strictEqual(getComputedDisplay(lightbox), "none");
211226` ` `
@@ -219,9 +234,12 @@ function getComputedDisplay(element) {
219234 return window.getComputedStyle(element).display;
220235}
221236
222- lightbox.style.display = "flex";
237+ const galleryItem = document.querySelector(".gallery-item");
238+ galleryItem.dispatchEvent(new Event("click", { bubbles: true }));
239+
240+ assert.strictEqual(getComputedDisplay(lightbox), "flex");
223241
224- lightbox.dispatchEvent(new Event("click"));
242+ lightbox.dispatchEvent(new Event("click", { bubbles: true } ));
225243
226244assert.strictEqual(getComputedDisplay(lightbox), "none");
227245```
0 commit comments