Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005'

This commit is contained in:
WPT Sync Bot 2022-11-10 01:22:36 +00:00
parent ace9b32b1c
commit df68c4e5d1
15632 changed files with 514865 additions and 155000 deletions

View file

@ -0,0 +1,40 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>summary element: clicking on anchor without link</title>
<link rel="author" title="Di Zhang" href="mailto:dizhangg@chromium.org">
<link rel="help" href="https://html.spec.whatwg.org/C/#the-summary-element">
<link rel="help" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<details id="details">
<summary><a id="no_inline">Details</a></summary>
<p>Text</p>
</details>
<details id="details_inline">
<summary><a><i id="has_inline">Details</i></a></summary>
<p>Text</p>
</details>
<script>
async function testClickingOnAnchorWithoutLink (detailsId, targetId) {
const details = document.getElementById(detailsId);
const target = document.getElementById(targetId);
const initialLoc = location.hash;
assert_false(details.open);
target.click();
assert_true(details.open);
assert_equals(location.hash, initialLoc);
}
promise_test(() => testClickingOnAnchorWithoutLink('details', 'no_inline'),
"clicking on anchor without link should open details and not navigate.");
promise_test(() => testClickingOnAnchorWithoutLink('details_inline', 'has_inline'),
"clicking on anchor without link, with embedded inline element should open details and not navigate.");
</script>

View file

@ -0,0 +1,104 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Summary</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<details>
<summary>Summary</summary>
Details
</details>
<script type="module">
const details = document.querySelector("details");
details.addEventListener("toggle",
(e) => assert_true(false, 'details should not be toggled'));
const summary = document.querySelector("summary");
summary.addEventListener("click",
(e) => assert_true(false, `summary should not be clicked`));
test(() => {
// keyCode: Enter
summary.dispatchEvent(
new KeyboardEvent("keypress", {
keyCode: 13,
})
);
// key: Enter
summary.dispatchEvent(
new KeyboardEvent("keypress", {
key: "Enter",
})
);
// keyCode: Space
summary.dispatchEvent(
new KeyboardEvent("keypress", {
keyCode: 32,
})
);
// key: Space
summary.dispatchEvent(
new KeyboardEvent("keypress", {
key: " ",
})
);
}, `Dispatching untrusted keypress events to summary should not cause click event`);
test(() => {
// keyCode: Enter
summary.dispatchEvent(
new KeyboardEvent("keydown", {
keyCode: 13,
})
);
summary.dispatchEvent(
new KeyboardEvent("keyup", {
keyCode: 13,
})
);
// key: Enter
summary.dispatchEvent(
new KeyboardEvent("keydown", {
key: "Enter",
})
);
summary.dispatchEvent(
new KeyboardEvent("keyup", {
key: "Enter",
})
);
// keyCode: Space
summary.dispatchEvent(
new KeyboardEvent("keydown", {
keyCode: 32,
})
);
summary.dispatchEvent(
new KeyboardEvent("keyup", {
keyCode: 32,
})
);
// key: Space
summary.dispatchEvent(
new KeyboardEvent("keydown", {
key: " ",
})
);
summary.dispatchEvent(
new KeyboardEvent("keyup", {
key: " ",
})
);
}, `Dispatching untrusted keyup/keydown events to summary should not cause click event`);
</script>
</body>
</html>