Tests: Move window.internals.getComputedLabel into testdriver.js file

This change takes the change we made in 120bc52f23 to patch the imported
WPT aria-utils.js file to use our window.internals.getComputedLabel(el)
function, and moves that patching into the imported WPT testdriver.js
file — in the same way we did in c5966bbdcb.

That centralizes the patching, and avoids the need to patch multiple
other WPT tests we’re likely to import eventually. There are actually
six different WPT test files upstream which we haven’t imported yet that
call window.test_driver_internal.get_computed_label(el) directly — and
that, without this change, we’d otherwise end up needing to patch.
This commit is contained in:
sideshowbarker 2024-12-07 16:08:34 +09:00 committed by Tim Ledbetter
parent 46b95182a0
commit e10db3aaf0
Notes: github-actions[bot] 2024-12-07 08:26:21 +00:00
2 changed files with 6 additions and 4 deletions

View file

@ -233,7 +233,11 @@
* rejected in the cases the WebDriver command errors
*/
get_computed_label: async function(element) {
let label = await window.test_driver_internal.get_computed_label(element);
// XXX: Ladybird-specific change: Upstream WPT calls
// window.test_driver_internal.get_computed_label(element) here,
// but weve changed that to our Ladybird-specific
// window.internals.getComputedLabel(el).
let label = await window.internals.getComputedLabel(element);
return label;
},

View file

@ -143,9 +143,7 @@ const AriaUtils = {
}
promise_test(async t => {
const expectedLabel = el.getAttribute("data-expectedlabel");
// XXX: Ladybird-specific change: upstream WPT has test_driver.get_computed_label(el) here,
// but weve changed that to the Ladybird-specific window.internals.getComputedLabel(el).
let computedLabel = await window.internals.getComputedLabel(el);
let computedLabel = await test_driver.get_computed_label(el);
assert_not_equals(computedLabel, null, `get_computed_label(el) shouldn't return null for ${el.outerHTML}`);
// See: