Skip to content

Commit e0177c5

Browse files
mfreed7chromium-wpt-export-bot
authored andcommitted
Fix the popover-attribute-basic.tentative.html test
This test has been disabled for some time, while [1] was landed. Then [2] landed, which changed the event names/behavior, but that CL forgot to update this test. Additionally, there was a crash that was fixed in [3]. This CL cleans it up and re-enables it finally. [1] https://chromium-review.googlesource.com/c/chromium/src/+/4074305 [2] https://chromium-review.googlesource.com/c/chromium/src/+/4035832 [3] https://chromium-review.googlesource.com/c/chromium/src/+/4074665 Bug: 1307772 Change-Id: I3f0b9fb604a04cb0cc28370f40d8b02d5fce11ac Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4090644 Commit-Queue: Mason Freed <[email protected]> Auto-Submit: Mason Freed <[email protected]> Reviewed-by: Joey Arhar <[email protected]> Cr-Commit-Position: refs/heads/main@{#1081664}
1 parent 88b961b commit e0177c5

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

html/semantics/popovers/popover-attribute-basic.tentative.html

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,17 @@
275275
other_popover.showPopover();
276276
const popover = createPopover(t);
277277
popover.setAttribute('popover','auto');
278-
other_popover.addEventListener('toggle', (e) => {
279-
if (e.state !== "closing") return;
278+
other_popover.addEventListener('beforetoggle', (e) => {
279+
if (e.newState !== "closed")
280+
return;
280281
popover.setAttribute('popover','manual');
281282
},{once: true});
282283
assert_true(other_popover.matches(':open'));
283284
assert_false(popover.matches(':open'));
284285
popover.showPopover();
285286
assert_false(other_popover.matches(':open'),'unrelated popover is hidden');
286287
assert_false(popover.matches(':open'),'popover is not shown if its type changed during show');
287-
},`Changing the popover type in a "toggle" event handler should not cause problems (during showPopover())`);
288+
},`Changing the popover type in a "beforetoggle" event handler should not cause problems (during showPopover())`);
288289

289290
test((t) => {
290291
const popover = createPopover(t);
@@ -295,13 +296,15 @@
295296
popover.showPopover();
296297
other_popover.showPopover();
297298
let nested_popover_hidden=false;
298-
other_popover.addEventListener('toggle', (e) => {
299-
if (e.state !== "closing") return;
299+
other_popover.addEventListener('beforetoggle', (e) => {
300+
if (e.newState !== "closed")
301+
return;
300302
nested_popover_hidden = true;
301303
popover.setAttribute('popover','manual');
302304
},{once: true});
303-
popover.addEventListener('toggle', (e) => {
304-
if (e.state !== "closing") return;
305+
popover.addEventListener('beforetoggle', (e) => {
306+
if (e.newState !== "closed")
307+
return;
305308
assert_true(nested_popover_hidden,'The nested popover should be hidden first');
306309
},{once: true});
307310
assert_true(popover.matches(':open'));
@@ -310,7 +313,7 @@
310313
assert_false(other_popover.matches(':open'),'unrelated popover is hidden');
311314
assert_false(popover.matches(':open'),'popover is still hidden if its type changed during hide event');
312315
assert_throws_dom("InvalidStateError",() => other_popover.hidePopover(),'Nested popover should already be hidden');
313-
},`Changing the popover type in a "toggle" event handler should not cause problems (during hidePopover())`);
316+
},`Changing the popover type in a "beforetoggle" event handler should not cause problems (during hidePopover())`);
314317

315318
function interpretedType(typeString,method) {
316319
if (validTypes.includes(typeString))
@@ -347,8 +350,9 @@
347350
popover.showPopover();
348351
assert_true(popover.matches(':open'));
349352
let gotEvent = false;
350-
popover.addEventListener('toggle', (e) => {
351-
if (e.state !== "closing") return;
353+
popover.addEventListener('beforetoggle', (e) => {
354+
if (e.newState !== "closed")
355+
return;
352356
gotEvent = true;
353357
setPopoverValue(popover,inEventType,method);
354358
},{once:true});
@@ -384,7 +388,7 @@
384388
}
385389
}
386390
}
387-
},`Changing a popover from ${type} to ${newType} (via ${method}), and then ${inEventType} during 'toggle' works`);
391+
},`Changing a popover from ${type} to ${newType} (via ${method}), and then ${inEventType} during 'beforetoggle' works`);
388392
});
389393
});
390394
});

0 commit comments

Comments
 (0)