Files
sousa-gecko/testing/web-platform/tests/html/semantics/interestfor/interestevent-interface.tentative.html
T
Mason Freed 31c483bdc6 Bug 1986861 [wpt PR 54683] - Move interestfor tests up to a separate directory, a=testonly
Automatic update from web-platform-tests
Move interestfor tests up to a separate directory

It was a bit weird to have them inside `the-button-element`, so
this moves them to be a sibling of e.g. `popovers`.

See crbug.com/442879524:

Validate-Test-Flakiness: skip
Bug: 326681249, 442879524
Change-Id: Ia2eb96f46ade6c7c200d9c8ea90d003e614e0750
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6912044
Commit-Queue: Dominic Farolino <dom@chromium.org>
Auto-Submit: Mason Freed <masonf@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1510684}

--

wpt-commits: 31249bea3e9e16733c3c6bb132e60b68574b017a
wpt-pr: 54683
2025-09-08 14:29:01 +00:00

96 lines
2.9 KiB
HTML

<!doctype html>
<meta charset="utf-8" />
<link rel="author" title="Keith Cirkel" href="mailto:keithamus@github.com" >
<link rel="author" title="Luke Warlow" href="mailto:lwarlow@igalia.com" >
<link rel="help" href="https://open-ui.org/components/interest-invokers.explainer/" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/invoker-utils.js"></script>
<div id="div"></div>
<button id="button"></button>
<script>
test(function () {
const event = new InterestEvent("test");
assert_equals(event.source, null);
assert_readonly(event, "source", "readonly attribute value");
}, "source is readonly defaulting to null");
test(function () {
const eventInit = { source: document.body };
const event = new InterestEvent("test", eventInit);
assert_equals(event.source, document.body);
}, "InterestEventInit properties set value (manual event)");
test(function () {
const eventInit = {
source: document.getElementById("div"),
};
const event = new InterestEvent("beforetoggle", eventInit);
assert_equals(event.source, document.getElementById("div"));
}, "InterestEventInit properties set value (beforetoggle event)");
test(function () {
const eventInit = {
source: document.getElementById("button"),
};
const event = new InterestEvent("toggle", eventInit);
assert_equals(event.source, document.getElementById("button"));
}, "InterestEventInit properties set value (toggle event)");
test(function () {
const event = new InterestEvent("test", { source: undefined });
assert_equals(event.source, null);
}, "source set to undefined");
test(function () {
const event = new InterestEvent("test", { source: null });
assert_equals(event.source, null);
}, "source set to null");
test(function () {
assert_throws_js(
TypeError,
function () {
new InterestEvent("test", { source: false });
},
"source is not an object",
);
}, "source set to false");
test(function () {
assert_throws_js(
TypeError,
function () {
const event = new InterestEvent("test", { source: true });
},
"source is not an object",
);
}, "source set to true");
test(function () {
assert_throws_js(
TypeError,
function () {
const event = new InterestEvent("test", { source: {} });
},
"source is not an object",
);
}, "source set to {}");
test(function () {
assert_throws_js(
TypeError,
function () {
const eventInit = { source: new XMLHttpRequest() };
const event = new InterestEvent("toggle", eventInit);
},
"source is not an Element",
);
}, "source set to non-Element EventTarget");
</script>