Update web-platform-tests to revision de3ae39cb59880a8245431e7f09817a2a4dad1a3

This commit is contained in:
WPT Sync Bot 2018-06-15 21:19:30 -04:00
parent 0c5b020163
commit b322aa3943
131 changed files with 2717 additions and 600 deletions

View file

@ -1,11 +1,10 @@
[createImageBitmap-drawImage.html] [createImageBitmap-drawImage.html]
type: testharness type: testharness
expected: TIMEOUT
[createImageBitmap from a HTMLImageElement, and drawImage on the created ImageBitmap] [createImageBitmap from a HTMLImageElement, and drawImage on the created ImageBitmap]
expected: FAIL expected: FAIL
[createImageBitmap from a Blob, and drawImage on the created ImageBitmap] [createImageBitmap from a Blob, and drawImage on the created ImageBitmap]
expected: NOTRUN expected: FAIL
[createImageBitmap from a HTMLCanvasElement, and drawImage on the created ImageBitmap] [createImageBitmap from a HTMLCanvasElement, and drawImage on the created ImageBitmap]
expected: FAIL expected: FAIL
@ -47,10 +46,10 @@
expected: FAIL expected: FAIL
[createImageBitmap from an ImageBitmap with negative sw/sh, and drawImage on the created ImageBitmap] [createImageBitmap from an ImageBitmap with negative sw/sh, and drawImage on the created ImageBitmap]
expected: NOTRUN expected: FAIL
[createImageBitmap from a Blob with negative sw/sh, and drawImage on the created ImageBitmap] [createImageBitmap from a Blob with negative sw/sh, and drawImage on the created ImageBitmap]
expected: NOTRUN expected: FAIL
[createImageBitmap from a bitmap HTMLImageElement, and drawImage on the created ImageBitmap] [createImageBitmap from a bitmap HTMLImageElement, and drawImage on the created ImageBitmap]
expected: FAIL expected: FAIL
@ -167,17 +166,17 @@
expected: FAIL expected: FAIL
[createImageBitmap from an ImageBitmap scaled up, and drawImage on the created ImageBitmap] [createImageBitmap from an ImageBitmap scaled up, and drawImage on the created ImageBitmap]
expected: TIMEOUT expected: FAIL
[createImageBitmap from an ImageBitmap resized, and drawImage on the created ImageBitmap] [createImageBitmap from an ImageBitmap resized, and drawImage on the created ImageBitmap]
expected: NOTRUN expected: FAIL
[createImageBitmap from a Blob scaled down, and drawImage on the created ImageBitmap] [createImageBitmap from a Blob scaled down, and drawImage on the created ImageBitmap]
expected: NOTRUN expected: FAIL
[createImageBitmap from a Blob scaled up, and drawImage on the created ImageBitmap] [createImageBitmap from a Blob scaled up, and drawImage on the created ImageBitmap]
expected: NOTRUN expected: FAIL
[createImageBitmap from a Blob resized, and drawImage on the created ImageBitmap] [createImageBitmap from a Blob resized, and drawImage on the created ImageBitmap]
expected: NOTRUN expected: FAIL

File diff suppressed because it is too large Load diff

View file

@ -3,3 +3,6 @@
[The class string of an interface prototype object is the concatenation of the interface's identifier and the string 'Prototype'.] [The class string of an interface prototype object is the concatenation of the interface's identifier and the string 'Prototype'.]
expected: FAIL expected: FAIL
[[Unscopable\] extended attribute makes @@unscopables object on the prototype object, whose prototype is null.]
expected: FAIL

View file

@ -323,3 +323,6 @@
[Matching font-style: 'normal' should prefer 'oblique 20deg 30deg' over 'oblique -50deg -20deg'] [Matching font-style: 'normal' should prefer 'oblique 20deg 30deg' over 'oblique -50deg -20deg']
expected: FAIL expected: FAIL
[Matching font-style: 'oblique -21deg' should prefer 'oblique 30deg 60deg' over 'oblique 40deg 50deg']
expected: FAIL

View file

@ -32,3 +32,12 @@
[Test @font-face matching for weight 420] [Test @font-face matching for weight 420]
expected: FAIL expected: FAIL
[Test @font-face matching for weight 99]
expected: FAIL
[Test @font-face matching for weight 100]
expected: FAIL
[Test @font-face matching for weight 249]
expected: FAIL

View file

@ -2,3 +2,6 @@
[CSS Test (Selectors): Keyboard focus enables :focus-visible] [CSS Test (Selectors): Keyboard focus enables :focus-visible]
expected: FAIL expected: FAIL
[CSS Test (Selectors): Programmatic focus causes :focus-visible to match]
expected: FAIL

View file

@ -1,6 +1,5 @@
[window_length.html] [window_length.html]
type: testharness type: testharness
[Opened window] [Opened window]
expected: FAIL expected: FAIL

View file

@ -0,0 +1,4 @@
[010.html]
[Salvagability of document.opened document]
expected: FAIL

View file

@ -202,33 +202,33 @@
[XHTML img usemap="#different-CASE-id"] [XHTML img usemap="#different-CASE-id"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="no-hash-name"] [HTML (quirks) IMG usemap="no-hash-name"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="no-hash-id"] [HTML (quirks) IMG usemap="no-hash-id"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="hash-last#"] [HTML (quirks) IMG usemap="hash-last#"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap=""] [HTML (quirks) IMG usemap=""]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="#"] [HTML (quirks) IMG usemap="#"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="#percent-escape-name-%41"] [HTML (quirks) IMG usemap="#percent-escape-name-%41"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="#percent-escape-id-%41"] [HTML (quirks) IMG usemap="#percent-escape-id-%41"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="#no-such-map"] [HTML (quirks) IMG usemap="#no-such-map"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="#different-CASE-name"] [HTML (quirks) IMG usemap="#different-CASE-name"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="#different-CASE-id"] [HTML (quirks) IMG usemap="#different-CASE-id"]
expected: FAIL expected: FAIL

View file

@ -0,0 +1,19 @@
[basic-auth.https.any.serviceworker.html]
[Untitled]
expected: FAIL
[basic-auth.any.sharedworker.html]
[Untitled]
expected: FAIL
[basic-auth.any.html]
[HTTP basic authentication should work with WebSockets]
expected: FAIL
[basic-auth.any.worker.html]
[HTTP basic authentication should work with WebSockets]
expected: FAIL

View file

@ -0,0 +1,4 @@
[worker-from-blob-url.window.html]
[Untitled]
expected: FAIL

View file

@ -1,2 +0,0 @@
[hide_after_load.html]
expected: TIMEOUT

View file

@ -1,5 +0,0 @@
[context-release-with-workers.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,4 +1,4 @@
[context-release-upon-reload.html] [shader-uniform-packing-restrictions.html]
expected: TIMEOUT expected: TIMEOUT
[Overall test] [Overall test]
expected: NOTRUN expected: NOTRUN

View file

@ -421,10 +421,10 @@ because we have to go through all the tests and ensure that they match
the specification correctly. But we look at all of them, and take the specification correctly. But we look at all of them, and take
everything that we can. everything that we can.
OWNERS files are used only to indicate who should be notified of pull META.yml files are used only to indicate who should be notified of pull
requests. If you are interested in receiving notifications of proposed requests. If you are interested in receiving notifications of proposed
changes to tests in a given directory, feel free to add yourself to the changes to tests in a given directory, feel free to add yourself to the
OWNERS file. Anyone with expertise in the specification under test can META.yml file. Anyone with expertise in the specification under test can
approve a pull request. In particular, if a test change has already approve a pull request. In particular, if a test change has already
been adequately reviewed "upstream" in another repository, it can be been adequately reviewed "upstream" in another repository, it can be
pushed here without any further review by supplying a link to the pushed here without any further review by supplying a link to the
@ -434,7 +434,7 @@ Search filters to find things to review:
* [Open PRs (excluding vendor exports)](https://github.com/web-platform-tests/wpt/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+-label%3A%22mozilla%3Agecko-sync%22+-label%3A%22chromium-export%22+-label%3A%22webkit-export%22+-label%3A%22servo-export%22) * [Open PRs (excluding vendor exports)](https://github.com/web-platform-tests/wpt/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+-label%3A%22mozilla%3Agecko-sync%22+-label%3A%22chromium-export%22+-label%3A%22webkit-export%22+-label%3A%22servo-export%22)
* [Reviewed but still open PRs (excluding vendor exports)](https://github.com/web-platform-tests/wpt/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+-label%3Amozilla%3Agecko-sync+-label%3Achromium-export+-label%3Awebkit-export+-label%3Aservo-export+review%3Aapproved+-label%3A%22do+not+merge+yet%22+-label%3A%22status%3Aneeds-spec-decision%22) (Merge? Something left to fix? Ping other reviewer?) * [Reviewed but still open PRs (excluding vendor exports)](https://github.com/web-platform-tests/wpt/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+-label%3Amozilla%3Agecko-sync+-label%3Achromium-export+-label%3Awebkit-export+-label%3Aservo-export+review%3Aapproved+-label%3A%22do+not+merge+yet%22+-label%3A%22status%3Aneeds-spec-decision%22) (Merge? Something left to fix? Ping other reviewer?)
* [Open PRs without owners](https://github.com/web-platform-tests/wpt/pulls?q=is%3Apr+is%3Aopen+label%3Astatus%3Aneeds-owners) * [Open PRs without reviewers](https://github.com/web-platform-tests/wpt/pulls?q=is%3Apr+is%3Aopen+label%3Astatus%3Aneeds-reviewers)
* [Open PRs with label `infra` (excluding vendor exports)](https://github.com/web-platform-tests/wpt/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+label%3Ainfra+-label%3A%22mozilla%3Agecko-sync%22+-label%3A%22chromium-export%22+-label%3A%22webkit-export%22+-label%3A%22servo-export%22) * [Open PRs with label `infra` (excluding vendor exports)](https://github.com/web-platform-tests/wpt/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+label%3Ainfra+-label%3A%22mozilla%3Agecko-sync%22+-label%3A%22chromium-export%22+-label%3A%22webkit-export%22+-label%3A%22servo-export%22)
* [Open PRs with label `docs` (excluding vendor exports)](https://github.com/web-platform-tests/wpt/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+label%3Adocs+-label%3A%22mozilla%3Agecko-sync%22+-label%3A%22chromium-export%22+-label%3A%22webkit-export%22+-label%3A%22servo-export%22) * [Open PRs with label `docs` (excluding vendor exports)](https://github.com/web-platform-tests/wpt/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+label%3Adocs+-label%3A%22mozilla%3Agecko-sync%22+-label%3A%22chromium-export%22+-label%3A%22webkit-export%22+-label%3A%22servo-export%22)

View file

@ -16,4 +16,12 @@ test(function() {
assert_equals(Document.prototype[Symbol.toStringTag], "DocumentPrototype"); assert_equals(Document.prototype[Symbol.toStringTag], "DocumentPrototype");
}, "The class string of an interface prototype object is the concatenation of " + }, "The class string of an interface prototype object is the concatenation of " +
"the interface's identifier and the string 'Prototype'."); "the interface's identifier and the string 'Prototype'.");
test(function() {
// https://heycam.github.io/webidl/#create-an-interface-prototype-object
assert_own_property(Element.prototype, Symbol.unscopables, "Element.prototype has @@unscopables.");
let unscopables = Element.prototype[Symbol.unscopables];
assert_equals(typeof unscopables, "object", "@@unscopables is an Object.");
assert_equals(Object.getPrototypeOf(unscopables), null, "@@unscopables's prototype is null.");
}, "[Unscopable] extended attribute makes @@unscopables object on the prototype object, whose prototype is null.");
</script> </script>

View file

@ -8,6 +8,6 @@
<script> <script>
"use strict"; "use strict";
run_fp_tests_disabled(AmbientLightSensor); run_fp_tests_disabled('AmbientLightSensor');
</script> </script>
</body> </body>

View file

@ -8,6 +8,6 @@
<script> <script>
"use strict"; "use strict";
run_fp_tests_enabled_by_attribute_redirect_on_load(AmbientLightSensor); run_fp_tests_enabled_by_attribute_redirect_on_load('AmbientLightSensor');
</script> </script>
</body> </body>

View file

@ -8,6 +8,6 @@
<script> <script>
"use strict"; "use strict";
run_fp_tests_enabled_by_attribute(AmbientLightSensor); run_fp_tests_enabled_by_attribute('AmbientLightSensor');
</script> </script>
</body> </body>

View file

@ -8,6 +8,6 @@
<script> <script>
"use strict"; "use strict";
run_fp_tests_enabled(AmbientLightSensor); run_fp_tests_enabled('AmbientLightSensor');
</script> </script>
</body> </body>

View file

@ -8,6 +8,6 @@
<script> <script>
"use strict"; "use strict";
run_fp_tests_enabled_on_self_origin(AmbientLightSensor); run_fp_tests_enabled_on_self_origin('AmbientLightSensor');
</script> </script>
</body> </body>

View file

@ -9,6 +9,6 @@
<div id="log"></div> <div id="log"></div>
<script> <script>
runGenericSensorTests(AmbientLightSensor); runGenericSensorTests('AmbientLightSensor');
</script> </script>

View file

@ -15,6 +15,6 @@
</ol> </ol>
<script> <script>
runGenericSensorOnerror(AmbientLightSensor); runGenericSensorOnerror('AmbientLightSensor');
</script> </script>

View file

@ -16,7 +16,7 @@
} }
</script> </script>
<iframe src="support/sandboxed-post-message-to-parent.sub.html?sandbox=allow-scripts"></iframe> <iframe src="support/sandboxed-post-message-to-parent.html?sandbox=allow-scripts"></iframe>
</body> </body>
</html> </html>

View file

@ -0,0 +1,3 @@
<script>
window.opener.postMessage(window.testProperty, "*");
</script>

View file

@ -0,0 +1,3 @@
<script>
window.opener.postMessage(window.testProperty, "*");
</script>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
var t = async_test("Window object should not be reused");
window.onmessage = t.step_func_done(function(e) {
assert_equals(e.data, undefined);
});
w = window.open("support/sandboxed-post-property-to-opener.html?sandbox=allow-scripts","","width=400,height=400");
w.testProperty = "test";
</script>
</body>
</html>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
var t = async_test("Window object should be reused");
window.onmessage = t.step_func_done(function(e) {
assert_equals(e.data, "test");
});
w = window.open("support/unsandboxed-post-property-to-opener.html","","width=400,height=400");
w.testProperty = "test";
</script>
</body>
</html>

View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<p>The second line should be just below the first line.</p>
<div style="padding-left:100px;">
Line 1<br>
Line 2
</div>

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<title>Auto-positioned out-of-flow positioned box that would have been the sole piece of content on a second line, had it not been out-of-flow positioned</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/CSS22/visudet.html#abs-non-replaced-height" title="10.6.4 Absolutely positioned, non-replaced elements">
<link rel="match" href="hypothetical-inline-alone-on-second-line-ref.html" />
<p>The second line should be just below the first line.</p>
<span style="padding-left:100px;">
Line 1<br>
<span style="position:absolute; padding-left:100px;">Line 2</span>
</span>

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<title>Last block with negative in container that reduces container height</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/CSS22/box.html#collapsing-margins" title="8.3.1 Collapsing margins">
<link rel="match" href="../../reference/ref-filled-green-200px-square.html">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="width:200px; background:red;">
<div style="height:200px;">
<div style="height:80px; background:green;"></div>
</div>
<div style="margin-top:-120px; height:20px; background:green;"></div>
</div>
<div style="width:200px; height:100px; background:green;"></div>

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<title>Last block with negative in container that reduces container height</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/CSS22/box.html#collapsing-margins" title="8.3.1 Collapsing margins">
<link rel="match" href="../../reference/ref-filled-green-200px-square.html">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="overflow:hidden; width:200px; background:red;">
<div style="height:200px; background:green;"></div>
<div style="height:200px; margin-bottom:-200px;"></div>
</div>

View file

@ -3,8 +3,8 @@
<title>CSS Containment Test: Size containment on table</title> <title>CSS Containment Test: Size containment on table</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com"> <link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-contain-1/#containment-size"> <link rel="help" href="https://drafts.csswg.org/css-contain-1/#containment-size">
<link rel="match" href="reference/contain-paint-014-ref.html"> <link rel="match" href="reference/contain-size-001-ref.html">
<meta name=assert content="Size containment does apply to table elements."> <meta name=assert content="Size containment doesn't apply to table elements.">
<style> <style>
div { div {
display: table; display: table;
@ -13,5 +13,5 @@ div {
} }
</style> </style>
<p>This test passes if you can NOT see the word FAIL below.</p> <p>This test passes if you can see the word PASS below.</p>
<div>FAIL</div> <div>PASS</div>

View file

@ -0,0 +1,18 @@
<!doctype html>
<title>CSS Test: non-HTML slot elements don't get display: contents by default.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="help" href="https://drafts.csswg.org/css-scoping/#slots-in-shadow-tree">
<link rel="help" href="https://bugzil.la/1468127">
<body>
<script>
test(function() {
const non_html_slot = document.createElementNS("http://www.w3.org/2000/svg", "slot");
document.body.appendChild(non_html_slot);
const display = getComputedStyle(non_html_slot).display;
// contents would get turned to "none" due to https://drafts.csswg.org/css-display/#unbox-svg
assert_true(display != "contents" && display != "none");
}, "Non-HTML slot elements shouldn't be display: contents by default.");
</script>
</body>

View file

@ -0,0 +1,48 @@
<!DOCTYPE html>
<title>CSSStyleDeclaration setter works when a node changes document</title>
<link rel="author" title="Raphael Kubo da Costa" href="raphael.kubo.da.costa@intel.com">
<link rel="help" href="https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-camel-cased-attribute">
<link rel="help" href="https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-webkit-cased-attribute">
<link rel="help" href="https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-dashed-attribute">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="original-div" style="background-color:green; height: 100px; width: 100px"></div>
<script>
// Create and return a 100x100 red <div>.
function createDiv(containerDocument) {
const div = containerDocument.createElement("div");
div.style.backgroundColor = "red";
div.style.height = "100px";
div.style.width = "100px";
containerDocument.body.appendChild(div);
return div;
}
async_test(t => {
const iframeElement = document.createElement("iframe");
iframeElement.addEventListener("load", t.step_func_done(() => {
const originalDiv = document.getElementById("original-div");
const newDiv = createDiv(iframeElement.contentDocument);
assert_not_equals(newDiv.ownerDocument, document,
"The new <div> belongs to the iframe, not the main document");
document.body.insertBefore(newDiv, originalDiv);
assert_equals(newDiv.ownerDocument, document,
"The new <div> now belongs to the main document");
newDiv.style.backgroundColor = "blue";
assert_equals(window.getComputedStyle(newDiv).getPropertyValue("background-color"),
"rgb(0, 0, 255)",
"The new <div>'s background-color is blue");
document.body.removeChild(iframeElement);
newDiv.style.backgroundColor = "green";
assert_equals(window.getComputedStyle(newDiv).getPropertyValue("background-color"),
"rgb(0, 128, 0)",
"The new <div>'s background-color is green");
}));
document.body.appendChild(iframeElement);
}, "Changing the style of a node that switched documents works");
</script>

View file

@ -8,21 +8,37 @@
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<style> <style>
:focus-visible { background-color: rgb(128, 196, 128); } :root {
--focus-background: hsl(50, 94%, 72%);
--focus-ring-color: rgb(59, 153, 252);
}
:focus-visible {
outline: var(--focus-ring-color) auto 5px;
}
* {
outline: 0;
}
:focus {
background-color: var(--focus-background);
}
</style> </style>
</head> </head>
<body> <body>
This test checks that using the Tab key to navigate focus to an element triggers <code>:focus-visible</code> matching.
<ol id="instructions"> <ol id="instructions">
<li>If the user-agent does not claim to support the <code>:focus-visible</code> pseudo-class then SKIP this test.</li> <li>If the user-agent does not claim to support the <code>:focus-visible</code> pseudo-class then SKIP this test.</li>
<li>Use the TAB key on the keyboard to focus the element below that says "Focus me."</li> <li>Use the TAB key on the keyboard to focus the element below that says "Focus me."</li>
<li>If the element does not have a green background, then the test result is FAILURE. If the element has a green background, then the test result is SUCCESS.</li> <li>If the element does not have a blue outline, then the test result is FAILURE. If the element has a blue outline, then the test result is SUCCESS.</li>
</ol> </ol>
<br /> <br>
<div id="el" tabindex="0">Focus me.</div> <div id="el" tabindex="0">Focus me.</div>
<script> <script>
async_test(function(t) { async_test(function(t) {
el.addEventListener("focus", t.step_func(function() { el.addEventListener("focus", t.step_func(function() {
assert_equals(getComputedStyle(el).backgroundColor, "rgb(128, 196, 128)"); assert_equals(getComputedStyle(el).outlineColor, "rgb(59, 153, 252)");
t.done(); t.done();
})); }));
}, "Keyboard focus should match :focus-visible"); }, "Keyboard focus should match :focus-visible");

View file

@ -2,22 +2,38 @@
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>CSS Test (Selectors): Keyboard focus enables :focus-visible</title> <title>CSS Test (Selectors): :focus-visible always matches on texty input elements</title>
<link rel="author" title="Alice Boxhall" href="aboxhall@chromium.org" /> <link rel="author" title="Alice Boxhall" href="aboxhall@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" /> <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" />
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<style> <style>
:focus-visible { background-color: rgb(128, 196, 128); } :root {
--focus-background: hsl(50, 94%, 72%);
--focus-ring-color: rgb(59, 153, 252);
}
:focus-visible {
outline: var(--focus-ring-color) auto 5px;
}
* {
outline: 0;
}
:focus {
background-color: var(--focus-background);
}
</style> </style>
</head> </head>
<body> <body>
This test checks that <code>:focus-visible</code> always matches on <code>&lt;input&gt;</code> elements which take text input, regardless of focus mechanism.
<ol id="instructions"> <ol id="instructions">
<li>If the user-agent does not claim to support the <code>:focus-visible</code> pseudo-class then SKIP this test.</li> <li>If the user-agent does not claim to support the <code>:focus-visible</code> pseudo-class then SKIP this test.</li>
<li><strong>Click</strong> each form element below to focus it.</li> <li><strong>Click</strong> each form element below to focus it.</li>
<li>If the element does not have a green background, then the test result is FAILURE. If the element has a green background, then the test result is SUCCESS.</li> <li>If the element does not have a blue outline, then the test result is FAILURE. If the element has a blue outline, then the test result is SUCCESS.</li>
</ol> </ol>
<br /> <br>
<div> <div>
<input data-tested="false" id="input1" value="Focus me."></input> <input data-tested="false" id="input1" value="Focus me."></input>
</div> </div>
@ -70,8 +86,7 @@
async_test(function(t) { async_test(function(t) {
function testNextTarget(e) { function testNextTarget(e) {
let el = e.target; let el = e.target;
assert_equals(getComputedStyle(el).backgroundColor, assert_equals(getComputedStyle(el).outlineColor, "rgb(59, 153, 252)");
"rgb(128, 196, 128)");
el.dataset.tested = true; el.dataset.tested = true;
let nextTarget = document.querySelector("[data-tested=false]"); let nextTarget = document.querySelector("[data-tested=false]");
if (nextTarget) { if (nextTarget) {

View file

@ -2,21 +2,36 @@
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>CSS Test (Selectors): Keyboard focus enables :focus-visible</title> <title>CSS Test (Selectors): :focus-visible does not match on non-texty inputs</title>
<link rel="author" title="Alice Boxhall" href="aboxhall@chromium.org" /> <link rel="author" title="Alice Boxhall" href="aboxhall@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" /> <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" />
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<style> <style>
:focus:not(:focus-visible) { background-color: rgb(128, 196, 128); } :root {
label:focus-within:not(:focus-visible) { background-color: rgb(128, 196, 128); } --focus-background: hsl(50, 94%, 72%);
--focus-ring-color: rgb(59, 153, 252);
}
:focus-visible {
outline: var(--focus-ring-color) auto 5px;
}
* {
outline: 0;
}
:focus {
background-color: var(--focus-background);
}
</style> </style>
</head> </head>
<body> <body>
This test checks that <code>:focus-visible</code> is <em>not</em> triggered by mouse focus on <code>&lt;input&gt;</code> elements which do not take text input.
<ol id="instructions"> <ol id="instructions">
<li>If the user-agent does not claim to support the <code>:focus-visible</code> pseudo-class then SKIP this test.</li> <li>If the user-agent does not claim to support the <code>:focus-visible</code> pseudo-class then SKIP this test.</li>
<li>Click each element element below to focus it.</li> <li>Click each element element below to focus it.</li>
<li>If the element does not have a green background, then the test result is FAILURE. If the element has a green background, then the test result is SUCCESS.</li> <li>If the element has a blue outline, then the test result is FAILURE. If the element does NOT have a blue outline, then the test result is SUCCESS.</li>
</ol> </ol>
<br /> <br />
<div> <div>
@ -64,8 +79,7 @@
document.querySelectorAll("[data-tested]").forEach((el) => { document.querySelectorAll("[data-tested]").forEach((el) => {
el.addEventListener("click", t.step_func((e) => { el.addEventListener("click", t.step_func((e) => {
let el = e.target; let el = e.target;
assert_equals(getComputedStyle(el).backgroundColor, assert_equals(getComputedStyle(el).outlineStyle, "none");
"rgb(128, 196, 128)");
el.dataset.tested = true; el.dataset.tested = true;
if (document.querySelector("[data-tested=false]")) { if (document.querySelector("[data-tested=false]")) {
mouseClickInTarget("[data-tested=false]"); mouseClickInTarget("[data-tested=false]");

View file

@ -2,22 +2,36 @@
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>CSS Test (Selectors): Keyboard focus enables :focus-visible</title> <title>CSS Test (Selectors): :focus-visible does not match on non-texty inputs with appearance: none</title>
<link rel="author" title="Rob Dodson" href="robdodson@chromium.org" /> <link rel="author" title="Alice Boxhall" href="aboxhall@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" /> <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" />
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<style> <style>
:focus:not(:focus-visible) { background-color: rgb(128, 196, 128); } :root {
label:focus-within:not(:focus-visible) { background-color: rgb(128, 196, 128); } --focus-background: hsl(50, 94%, 72%);
* { -webkit-appearance: none } --focus-ring-color: rgb(59, 153, 252);
}
:focus-visible {
outline: var(--focus-ring-color) auto 5px;
}
* {
outline: 0;
}
:focus {
background-color: var(--focus-background);
}
</style> </style>
</head> </head>
<body> <body>
This test checks that <code>:focus-visible</code> is <em>not</em> triggered by mouse focus on <code>&lt;input&gt;</code> elements which do not take text input, even if <code>appearance: none</code> is used.
<ol id="instructions"> <ol id="instructions">
<li>If the user-agent does not claim to support the <code>:focus-visible</code> pseudo-class then SKIP this test.</li> <li>If the user-agent does not claim to support the <code>:focus-visible</code> pseudo-class then SKIP this test.</li>
<li>Click each element element below to focus it.</li> <li>Click each element element below to focus it.</li>
<li>If the element does not have a green background, then the test result is FAILURE. If the element has a green background, then the test result is SUCCESS.</li> <li>If the element has a blue outline, then the test result is FAILURE. If the element does NOT have a blue outline, then the test result is SUCCESS.</li>
</ol> </ol>
<br /> <br />
<div> <div>
@ -65,8 +79,7 @@
document.querySelectorAll("[data-tested]").forEach((el) => { document.querySelectorAll("[data-tested]").forEach((el) => {
el.addEventListener("click", t.step_func((e) => { el.addEventListener("click", t.step_func((e) => {
let el = e.target; let el = e.target;
assert_equals(getComputedStyle(el).backgroundColor, assert_equals(getComputedStyle(el).outlineStyle, "none");
"rgb(128, 196, 128)");
el.dataset.tested = true; el.dataset.tested = true;
if (document.querySelector("[data-tested=false]")) { if (document.querySelector("[data-tested=false]")) {
mouseClickInTarget("[data-tested=false]"); mouseClickInTarget("[data-tested=false]");

View file

@ -1,38 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>CSS Test (Selectors): Keyboard focus enables :focus-visible</title>
<link rel="author" title="Rob Dodson" href="robdodson@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
:focus-visible { background-color: rgb(128, 196, 128); }
:focus:not(:focus-visible) { background-color: rgb(196, 128, 128); }
</style>
</head>
<body>
<ol id="instructions">
<li>If the user-agent does not claim to support the <code>:focus-visible</code> pseudo-class then SKIP this test.</li>
<li>Click the button below that says "Click me."</li>
<li>If the element that says "I will be focused programmatically." does not have a green background, then the test result is FAILURE. If the element has green background, then the test result is SUCCESS.</li>
</ol>
<br />
<button id="button">Click me.</button>
<div id="el" tabindex="-1">I will be focused programmatically.</el>
<script>
button.addEventListener("click", () => {
el.focus();
});
async_test(function(t) {
el.addEventListener("focus", t.step_func(() => {
assert_equals(getComputedStyle(el).backgroundColor,
"rgb(128, 196, 128)");
t.done();
}));
el.focus();
}, "Programmatic focus should always match :focus-visible");
</script>
</body>
</html>

View file

@ -2,36 +2,50 @@
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>CSS Test (Selectors): Keyboard focus enables :focus-visible</title> <title>CSS Test (Selectors): Programmatic focus causes :focus-visible to match</title>
<link rel="author" title="Rob Dodson" href="robdodson@chromium.org" /> <link rel="author" title="Alice Boxhall" href="aboxhall@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" /> <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" />
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<style> <style>
:focus-visible { background-color: rgb(128, 196, 128); } :root {
:focus:not(:focus-visible) { background-color: rgb(196, 128, 128); } --focus-background: hsl(50, 94%, 72%);
--focus-ring-color: rgb(59, 153, 252);
}
:focus-visible {
outline: var(--focus-ring-color) auto 5px;
}
* {
outline: 0;
}
:focus {
background-color: var(--focus-background);
}
</style> </style>
</head> </head>
<body> <body>
This test checks that programmatically focusing an element causes <code>:focus-visible</code> matching to trigger.
<ol id="instructions"> <ol id="instructions">
<li>If the user-agent does not claim to support the <code>:focus-visible</code> pseudo-class then SKIP this test.</li> <li>If the user-agent does not claim to support the <code>:focus-visible</code> pseudo-class then SKIP this test.</li>
<li>Click the button below that says "Click me."</li> <li>Click the button below that says "Click me."</li>
<li>If the element that says "I will be focused programmatically." does not have a <strong>green</strong> background, then the test result is FAILURE. If the element <em>has</em> a <strong>green</strong> background, then the test result is SUCCESS.</li> <li>If the element that says "I will be focused programmatically." does not have a blue outline, then the test result is FAILURE. If the element has a blue outline, then the test result is SUCCESS.</li>
</ol> </ol>
<br /> <br />
<button id="button">Click me.</button> <button id="button">Click me.</button>
<div id="el" tabindex="-1">I will be focused programmatically.</el> <div id="el" tabindex="-1">I will be focused programmatically.</div>
<script> <script>
button.addEventListener("click", () => { button.addEventListener("click", () => {
el.focus(); el.focus();
}); });
async_test(function(t) { async_test(function(t) {
el.addEventListener("focus", t.step_func(() => { el.addEventListener("focus", t.step_func(() => {
assert_equals(getComputedStyle(el).backgroundColor, assert_equals(getComputedStyle(el).outlineColor, "rgb(59, 153, 252)");
"rgb(128, 196, 128)"); t.done();
t.done(); }));
})); el.focus();
el.focus();
}, "Programmatic focus should always match :focus-visible"); }, "Programmatic focus should always match :focus-visible");
</script> </script>
</body> </body>

View file

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>CSS Test (Selectors): Keyboard focus enables :focus-visible</title> <title>CSS Test (Selectors): contenteditable elements always match :focus-visible</title>
<link rel="author" title="Alice Boxhall" href="aboxhall@chromium.org" /> <link rel="author" title="Alice Boxhall" href="aboxhall@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" /> <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" />
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
@ -13,14 +13,31 @@
background-color: white; background-color: white;
padding: 2px 5px; padding: 2px 5px;
} }
span[contenteditable]:focus-visible { background-color: rgb(128, 196, 128); }
:root {
--focus-background: hsl(50, 94%, 72%);
--focus-ring-color: rgb(59, 153, 252);
}
:focus-visible {
outline: var(--focus-ring-color) auto 5px;
}
* {
outline: 0;
}
:focus {
background-color: var(--focus-background);
}
</style> </style>
</head> </head>
<body> <body>
This test checks that <code>:focus-visible</code> always matches on elements with <code>contenteditable=true</code> set.
<ol id="instructions"> <ol id="instructions">
<li>If the user-agent does not claim to support the <code>:focus-visible</code> pseudo-class then SKIP this test.</li> <li>If the user-agent does not claim to support the <code>:focus-visible</code> pseudo-class then SKIP this test.</li>
<li><strong>Click</strong> the content editable span below to focus it.</li> <li><strong>Click</strong> the content editable span below to focus it.</li>
<li>If the element does not have a green background, then the test result is FAILURE. If the element has a green background, then the test result is SUCCESS.</li> <li>If the element does not have a blue outline, then the test result is FAILURE. If the element has a blue outline, then the test result is SUCCESS.</li>
</ol> </ol>
<br /> <br />
<div> <div>
@ -29,7 +46,7 @@
<script> <script>
async_test(function(t) { async_test(function(t) {
el.addEventListener("focus", t.step_func(function() { el.addEventListener("focus", t.step_func(function() {
assert_equals(getComputedStyle(el).backgroundColor, "rgb(128, 196, 128)"); assert_equals(getComputedStyle(el).outlineColor, "rgb(59, 153, 252)");
t.done(); t.done();
})); }));
}, "Focus should always match :focus-visible on content editable divs"); }, "Focus should always match :focus-visible on content editable divs");

View file

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>CSS Test (Selectors): Keyboard focus enables :focus-visible</title> <title>CSS Test (Selectors): Keyboard use triggers :focus-visible</title>
<link rel="author" title="Alice Boxhall" href="aboxhall@chromium.org" /> <link rel="author" title="Alice Boxhall" href="aboxhall@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" /> <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" />
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
@ -10,16 +10,38 @@
<script src="/resources/testdriver.js"></script> <script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script> <script src="/resources/testdriver-vendor.js"></script>
<style> <style>
body[data-hadkeydown] #one:focus-visible { background-color: rgb(128, 196, 128); } :root {
body:not([data-hadkeydown]) #one:focus-visible { background-color: rgb(196, 128, 128); } --focus-background: hsl(50, 94%, 72%);
--focus-ring-color: rgb(59, 153, 252);
}
body:not([data-hadkeydown]) #two:focus-visible { background-color: rgb(196, 128, 128); } :focus-visible {
body:not([data-hadkeydown]) #two:focus:not(:focus-visible) { outline: var(--focus-ring-color) auto 5px;
background-color: rgb(128, 196, 128); }
* {
outline-width: 0;
}
:focus {
background-color: var(--focus-background);
} }
</style> </style>
</head> </head>
<body> <body>
This test checks that using the keyboard in a way that does not move focus still causes <code>:focus-visible</code> matching to trigger.
<ol id="instructions">
<li>If the user-agent does not claim to support the <code>:focus-visible</code> pseudo-class then SKIP this test.</li>
<li>Use the mouse to focus the element below that says "Click me first."</li>
<li>If the element has a blue outline, then the test result is FAILURE.</li>
<li>Press the SHIFT key.</li>
<li>If the element now DOES NOT have a blue outline, then the test result is FAILURE..</li>
<li>Use the mouse to click the element that says "Click me first." a second time</li>
<li>If the element now DOES NOT still have a blue outline, then the test result is FAILURE.</li>
<li>Use the mouse to click the element below that says "Click me second."</li>
<li>If the element does not have a blue outline then the test result is SUCCESS.</li>
</ol>
<div id="one" tabindex="0">Click me first.</div> <div id="one" tabindex="0">Click me first.</div>
<div id="two" tabindex="0">Click me second.</div> <div id="two" tabindex="0">Click me second.</div>
<script> <script>
@ -54,7 +76,7 @@
}); });
const test_modality_change = t.step_func(() => { const test_modality_change = t.step_func(() => {
assert_equals(getComputedStyle(one).backgroundColor, "rgb(128, 196, 128)"); assert_equals(getComputedStyle(one).outlineColor, "rgb(59, 153, 252)");
tested_modality_change = true; tested_modality_change = true;
one.removeEventListener("keyup", test_modality_change); one.removeEventListener("keyup", test_modality_change);
one.addEventListener("click", test_modality_unchanged_by_mouse_click); one.addEventListener("click", test_modality_unchanged_by_mouse_click);
@ -63,7 +85,7 @@
const test_modality_unchanged_by_mouse_click = t.step_func(() => { const test_modality_unchanged_by_mouse_click = t.step_func(() => {
assert_true(tested_modality_change); assert_true(tested_modality_change);
assert_equals(getComputedStyle(one).backgroundColor, "rgb(128, 196, 128)"); assert_equals(getComputedStyle(one).outlineColor, "rgb(59, 153, 252)");
tested_modality_unchanged_by_mouse_click = true; tested_modality_unchanged_by_mouse_click = true;
one.removeEventListener("click", test_modality_unchanged_by_mouse_click); one.removeEventListener("click", test_modality_unchanged_by_mouse_click);
two.addEventListener("focus", test_mouse_focus_after_modality_change); two.addEventListener("focus", test_mouse_focus_after_modality_change);
@ -73,7 +95,7 @@
const test_mouse_focus_after_modality_change = t.step_func(() => { const test_mouse_focus_after_modality_change = t.step_func(() => {
assert_true(tested_modality_unchanged_by_mouse_click); assert_true(tested_modality_unchanged_by_mouse_click);
assert_false("hadkeydown" in document.body.dataset); assert_false("hadkeydown" in document.body.dataset);
assert_equals(getComputedStyle(two).backgroundColor, "rgb(128, 196, 128)"); assert_equals(getComputedStyle(two).outlineColor, "rgb(59, 153, 252)");
tested_mouse_focus_after_modality_change = true; tested_mouse_focus_after_modality_change = true;
t.done(); t.done();
}); });

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<meta charset="utf-8">
<title>CSS Reftest Reference</title>
<link rel="author" title="Dan Glastonbury" href="mailto:dglastonbury@mozilla.com" />
<style type="text/css">
body {
background: linear-gradient(to right, currentcolor, limegreen);
}
div {
width: 100vw;
height: 100vh;
background: linear-gradient(to right, limegreen, limegreen);
}
</style>
</head>
<body>
<!-- content of test -->
<div>
</body>
</html>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<meta charset="utf-8">
<title>CSS Test: 'color-stop' on linear-gradient respects 'currentcolor'</title>
<link rel="author" title="Dan Glastonbury" href="mailto:dglastonbury@mozilla.com" />
<link rel="help" href="https://www.w3.org/TR/css3-images/#color-stop-syntax" />
<link rel="help" href="https://www.w3.org/TR/css-color-3/#currentcolor" />
<link rel="match" href="color-stop-currentcolor-ref.html" />
<style type="text/css">
body {
background: linear-gradient(to right, currentcolor, limegreen);
}
div {
width: 100vw;
height: 100vh;
color: limegreen;
background: inherit;
}
</style>
</head>
<body>
<!-- content of test -->
<div>
</body>
</html>

View file

@ -189,3 +189,6 @@
== object-position-svg-002i.html object-position-svg-002-ref.html == object-position-svg-002i.html object-position-svg-002-ref.html
== object-position-svg-002o.html object-position-svg-002-ref.html == object-position-svg-002o.html object-position-svg-002-ref.html
== object-position-svg-002p.html object-position-svg-002-ref.html == object-position-svg-002p.html object-position-svg-002-ref.html
# Tests for gradient color stops with 'currentcolor'
== color-stop-currentcolor.html color-stop-currentcolor-ref.html

View file

@ -41,5 +41,6 @@ exclude:
- vendor/bundle/ - vendor/bundle/
- .bundle/ - .bundle/
- OWNERS - OWNERS
- META.yml
sass: sass:
sass_dir: assets/ sass_dir: assets/

View file

@ -185,7 +185,7 @@ In the example above, `foo()` returns a Promise that resolves with the string
a resolve reaction that verifies the returned value. a resolve reaction that verifies the returned value.
Note that in the promise chain constructed in `test_function` assertions don't Note that in the promise chain constructed in `test_function` assertions don't
need to wrapped in `step` or `step_func` calls. need to be wrapped in `step` or `step_func` calls.
Unlike Asynchronous Tests, Promise Tests don't start running until after the Unlike Asynchronous Tests, Promise Tests don't start running until after the
previous Promise Test finishes. previous Promise Test finishes.

View file

@ -146,6 +146,10 @@ be made available by the framework:
self.GLOBAL.isWindow() self.GLOBAL.isWindow()
self.GLOBAL.isWorker() self.GLOBAL.isWorker()
### Specifying a test title in auto-generated boilerplate tests
Use `// META: title=This is the title of the test` at the beginning of the resource.
### Including other JavaScript resources in auto-generated boilerplate tests ### Including other JavaScript resources in auto-generated boilerplate tests
Use `// META: script=link/to/resource.js` at the beginning of the resource. For example, Use `// META: script=link/to/resource.js` at the beginning of the resource. For example,

View file

@ -82,14 +82,13 @@ GitHub.
Pull Requests are automatically labeled based on the directory the Pull Requests are automatically labeled based on the directory the
files they change are in; there are also comments added automatically files they change are in; there are also comments added automatically
to notify a number of people: this list of people comes from OWNERS to notify a number of people: this list of people comes from META.yml
files in those same directories and their parents (i.e., they work files in those same directories and their parents (i.e., they work
recursively: `a/OWNERS` will get notified for `a/foo.html` and recursively: `a/META.yml` will get notified for `a/foo.html` and
`a/b/bar.html`). `a/b/bar.html`).
If you want to be notified about changes to tests in a directory, feel If you want to be notified about changes to tests in a directory, feel
free to add yourself to the OWNERS file: there's no requirement to own free to add yourself to the META.yml file!
anything as a result!
## Local Setup ## Local Setup

View file

@ -4,8 +4,27 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>iso-ir-149 decoding</title> <title>iso-ir-149 decoding</title>
<meta name="timeout" content="long"> <meta name="timeout" content="long">
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-6000">
<meta name="variant" content="?6001-7000">
<meta name="variant" content="?7001-8000">
<meta name="variant" content="?8001-9000">
<meta name="variant" content="?9001-10000">
<meta name="variant" content="?10001-11000">
<meta name="variant" content="?11001-12000">
<meta name="variant" content="?12001-13000">
<meta name="variant" content="?13001-14000">
<meta name="variant" content="?14001-15000">
<meta name="variant" content="?15001-16000">
<meta name="variant" content="?16001-17000">
<meta name="variant" content="?17001-last">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/common/subset-tests.js"></script>
<link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
<link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels"> <link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels">
<meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'iso-ir-149' as for a document labeled 'euc-kr'."> <meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'iso-ir-149' as for a document labeled 'euc-kr'.">

View file

@ -4,8 +4,27 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>korean decoding</title> <title>korean decoding</title>
<meta name="timeout" content="long"> <meta name="timeout" content="long">
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-6000">
<meta name="variant" content="?6001-7000">
<meta name="variant" content="?7001-8000">
<meta name="variant" content="?8001-9000">
<meta name="variant" content="?9001-10000">
<meta name="variant" content="?10001-11000">
<meta name="variant" content="?11001-12000">
<meta name="variant" content="?12001-13000">
<meta name="variant" content="?13001-14000">
<meta name="variant" content="?14001-15000">
<meta name="variant" content="?15001-16000">
<meta name="variant" content="?16001-17000">
<meta name="variant" content="?17001-last">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/common/subset-tests.js"></script>
<link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
<link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels"> <link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels">
<meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'korean' as for a document labeled 'euc-kr'."> <meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'korean' as for a document labeled 'euc-kr'.">

View file

@ -4,8 +4,27 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>ks_c_5601-1987 decoding</title> <title>ks_c_5601-1987 decoding</title>
<meta name="timeout" content="long"> <meta name="timeout" content="long">
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-6000">
<meta name="variant" content="?6001-7000">
<meta name="variant" content="?7001-8000">
<meta name="variant" content="?8001-9000">
<meta name="variant" content="?9001-10000">
<meta name="variant" content="?10001-11000">
<meta name="variant" content="?11001-12000">
<meta name="variant" content="?12001-13000">
<meta name="variant" content="?13001-14000">
<meta name="variant" content="?14001-15000">
<meta name="variant" content="?15001-16000">
<meta name="variant" content="?16001-17000">
<meta name="variant" content="?17001-last">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/common/subset-tests.js"></script>
<link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
<link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels"> <link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels">
<meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'ks_c_5601-1987' as for a document labeled 'euc-kr'."> <meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'ks_c_5601-1987' as for a document labeled 'euc-kr'.">

View file

@ -4,8 +4,27 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>ks_c_5601-1989 decoding</title> <title>ks_c_5601-1989 decoding</title>
<meta name="timeout" content="long"> <meta name="timeout" content="long">
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-6000">
<meta name="variant" content="?6001-7000">
<meta name="variant" content="?7001-8000">
<meta name="variant" content="?8001-9000">
<meta name="variant" content="?9001-10000">
<meta name="variant" content="?10001-11000">
<meta name="variant" content="?11001-12000">
<meta name="variant" content="?12001-13000">
<meta name="variant" content="?13001-14000">
<meta name="variant" content="?14001-15000">
<meta name="variant" content="?15001-16000">
<meta name="variant" content="?16001-17000">
<meta name="variant" content="?17001-last">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/common/subset-tests.js"></script>
<link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
<link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels"> <link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels">
<meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'ks_c_5601-1989' as for a document labeled 'euc-kr'."> <meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'ks_c_5601-1989' as for a document labeled 'euc-kr'.">

View file

@ -4,8 +4,27 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>ksc5601 decoding</title> <title>ksc5601 decoding</title>
<meta name="timeout" content="long"> <meta name="timeout" content="long">
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-6000">
<meta name="variant" content="?6001-7000">
<meta name="variant" content="?7001-8000">
<meta name="variant" content="?8001-9000">
<meta name="variant" content="?9001-10000">
<meta name="variant" content="?10001-11000">
<meta name="variant" content="?11001-12000">
<meta name="variant" content="?12001-13000">
<meta name="variant" content="?13001-14000">
<meta name="variant" content="?14001-15000">
<meta name="variant" content="?15001-16000">
<meta name="variant" content="?16001-17000">
<meta name="variant" content="?17001-last">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/common/subset-tests.js"></script>
<link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
<link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels"> <link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels">
<meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'ksc5601' as for a document labeled 'euc-kr'."> <meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'ksc5601' as for a document labeled 'euc-kr'.">

View file

@ -4,8 +4,27 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>windows-949 decoding</title> <title>windows-949 decoding</title>
<meta name="timeout" content="long"> <meta name="timeout" content="long">
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-6000">
<meta name="variant" content="?6001-7000">
<meta name="variant" content="?7001-8000">
<meta name="variant" content="?8001-9000">
<meta name="variant" content="?9001-10000">
<meta name="variant" content="?10001-11000">
<meta name="variant" content="?11001-12000">
<meta name="variant" content="?12001-13000">
<meta name="variant" content="?13001-14000">
<meta name="variant" content="?14001-15000">
<meta name="variant" content="?15001-16000">
<meta name="variant" content="?16001-17000">
<meta name="variant" content="?17001-last">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/common/subset-tests.js"></script>
<link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
<link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels"> <link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels">
<meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'windows-949' as for a document labeled 'euc-kr'."> <meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'windows-949' as for a document labeled 'euc-kr'.">

View file

@ -4,8 +4,27 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>EUC-KR decoding</title> <title>EUC-KR decoding</title>
<meta name="timeout" content="long"> <meta name="timeout" content="long">
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-6000">
<meta name="variant" content="?6001-7000">
<meta name="variant" content="?7001-8000">
<meta name="variant" content="?8001-9000">
<meta name="variant" content="?9001-10000">
<meta name="variant" content="?10001-11000">
<meta name="variant" content="?11001-12000">
<meta name="variant" content="?12001-13000">
<meta name="variant" content="?13001-14000">
<meta name="variant" content="?14001-15000">
<meta name="variant" content="?15001-16000">
<meta name="variant" content="?16001-17000">
<meta name="variant" content="?17001-last">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/common/subset-tests.js"></script>
<link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
<link rel="help" href="https://encoding.spec.whatwg.org/#euc-kr"> <link rel="help" href="https://encoding.spec.whatwg.org/#euc-kr">
<meta name="assert" content="The browser decodes all characters as expected from a file generated by encoding all pointers in the euc-kr encoding per the encoder steps in the specification."> <meta name="assert" content="The browser decodes all characters as expected from a file generated by encoding all pointers in the euc-kr encoding per the encoder steps in the specification.">

View file

@ -4,8 +4,12 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>Big5 decoding (extra)</title> <title>Big5 decoding (extra)</title>
<meta name="timeout" content="long"> <meta name="timeout" content="long">
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-last">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/common/subset-tests.js"></script>
<link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
<link rel="help" href="https://encoding.spec.whatwg.org/#big5"> <link rel="help" href="https://encoding.spec.whatwg.org/#big5">
<meta name="assert" content="The browser decodes all characters as expected from a file generated by encoding all pointers less than 5024 in the big5 encoding per the encoder steps in the specification."> <meta name="assert" content="The browser decodes all characters as expected from a file generated by encoding all pointers less than 5024 in the big5 encoding per the encoder steps in the specification.">

View file

@ -4,8 +4,24 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>x-x-big5 decoding</title> <title>x-x-big5 decoding</title>
<meta name="timeout" content="long"> <meta name="timeout" content="long">
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-6000">
<meta name="variant" content="?6001-7000">
<meta name="variant" content="?7001-8000">
<meta name="variant" content="?8001-9000">
<meta name="variant" content="?9001-10000">
<meta name="variant" content="?10001-11000">
<meta name="variant" content="?11001-12000">
<meta name="variant" content="?12001-13000">
<meta name="variant" content="?13001-14000">
<meta name="variant" content="?14001-last">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/common/subset-tests.js"></script>
<link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
<link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels"> <link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels">
<meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'x-x-big5' as for a document labeled 'big5'."> <meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'x-x-big5' as for a document labeled 'big5'.">

View file

@ -4,8 +4,24 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>Big5 decoding</title> <title>Big5 decoding</title>
<meta name="timeout" content="long"> <meta name="timeout" content="long">
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-6000">
<meta name="variant" content="?6001-7000">
<meta name="variant" content="?7001-8000">
<meta name="variant" content="?8001-9000">
<meta name="variant" content="?9001-10000">
<meta name="variant" content="?10001-11000">
<meta name="variant" content="?11001-12000">
<meta name="variant" content="?12001-13000">
<meta name="variant" content="?13001-14000">
<meta name="variant" content="?14001-last">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/common/subset-tests.js"></script>
<link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org"> <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
<link rel="help" href="https://encoding.spec.whatwg.org/#big5"> <link rel="help" href="https://encoding.spec.whatwg.org/#big5">
<meta name="assert" content="The browser decodes all characters as expected from a file generated by encoding all pointers in the big5 encoding per the encoder steps in the specification."> <meta name="assert" content="The browser decodes all characters as expected from a file generated by encoding all pointers in the big5 encoding per the encoder steps in the specification.">
@ -18,7 +34,7 @@
<script src="../../resources/decode-common.js"></script> <script src="../../resources/decode-common.js"></script>
</head> </head>
<body onload="showNodes();"> <body onload="showNodes(big5Decoder);">
<iframe src="big5_chars.html" name="scriptWindow" id="scrwin"></iframe> <iframe src="big5_chars.html" name="scriptWindow" id="scrwin"></iframe>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<style>
body, html {
height: 100%;
width: 100%;
overflow: hidden;
}
</style>
<body>
<p>This page blocks all 'mouse-wheel'.</p>
<script>
function defaultScroll() {
window.scrollTo(0, 0);
}
document.body.addEventListener(
"wheel",
(e) => { e.preventDefault(); defaultScroll(); }, {passive: false});
defaultScroll();
</script>
</body>

View file

@ -39,12 +39,11 @@ iframe {
// Wait for the helper scripts to load. // Wait for the helper scripts to load.
promise_test(async() => { promise_test(async() => {
if (window.touch_scroll_api_ready) if (window.input_api_ready)
return Promise.resolve(); return Promise.resolve();
await new Promise( (r) => { await new Promise( (r) => {
window.resolve_on_touch_scroll_api_ready = r; window.resolve_on_input_api_ready = r;
}); });
}, "Make sure input injection API is ready."); }, "Make sure input injection API is ready.");
// Sanity-check: Verify we can scroll using the test-API (empty <iframe>). // Sanity-check: Verify we can scroll using the test-API (empty <iframe>).

View file

@ -39,10 +39,10 @@ iframe {
// Wait for the helper scripts to load. // Wait for the helper scripts to load.
promise_test(async() => { promise_test(async() => {
if (window.touch_scroll_api_ready) if (window.input_api_ready)
return Promise.resolve(); return Promise.resolve();
await new Promise( (r) => { await new Promise( (r) => {
window.resolve_on_touch_scroll_api_ready = r; window.resolve_on_input_api_ready = r;
}); });
}, "Make sure input injection API is ready."); }, "Make sure input injection API is ready.");
@ -231,7 +231,7 @@ iframe {
assert_equals( assert_equals(
new_scale_factor, new_scale_factor,
current_scale_factor, current_scale_factor,
"Pinch zoom must be blocked.") "Pinch zoom must be blocked.");
}, "Verify that pinch zoom is blocked in frames with 'vertical-scroll' none'" + }, "Verify that pinch zoom is blocked in frames with 'vertical-scroll' none'" +
" where 'touchstart' is prevent defaulted."); " where 'touchstart' is prevent defaulted.");
</script> </script>

View file

@ -0,0 +1,145 @@
<!doctype html>
<title>vertical-scroll test for 'mousewheel'</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/feature-policy/experimental-features/resources/common.js"></script>
<script src="/feature-policy/experimental-features/resources/vertical-scroll.js"></script>
<style>
html, body {
height: 100%;
width: 100%;
}
iframe {
width: 90%;
height: 90%;
margin: 0;
padding: 0;
}
.spacer {
width: 100%;
height: 100%;
margin: 100%;
}
</style>
<iframe></iframe>
<br/>
<p>Spacers below to make page scrollable</p>
<br/>
<div class="spacer"></div>
<div class="spacer"></div>
<p> EOF </p>
<script>
"use strict";
let url = url_base + "vertical-scroll-wheel-block.html";
function iframeElement() {
return document.querySelector("iframe");
}
// Used as the polling interval when waiting for a specific condition.
let verify_scroll_offset_delay = 5;
let no_scroll_timout = 50;
function waitUntilSatisfied(testInstance, predicate) {
return new Promise((r) => {
function testPredicate() {
if (predicate()) {
r();
} else {
testInstance.step_timeout(testPredicate, verify_scroll_offset_delay);
}
}
testPredicate();
});
}
function resetScroll(testInstance) {
window.scrollTo({top: 0, left: 0, behavior: "instant"});
return waitUntilSatisfied(testInstance, () => {
return window.scrollX === 0 && window.scrollY === 0;
});
}
function waitForMinimumScrollOffset(testInstance, minX, minY) {
return waitUntilSatisfied(testInstance, () => {
return window.scrollX >= minX && window.scrollY >= minY;
});
}
function waitFor(testInstance, delay) {
let checked_once = false;
return waitUntilSatisfied(testInstance, () => {
if (checked_once)
return true;
checked_once = true;
return false;
});
}
// Wait for the helper scripts to load.
promise_test(async() => {
if (window.input_api_ready)
return Promise.resolve();
await new Promise((r) => {
window.resolve_on_input_api_ready = r;
});
}, "Make sure input injection API is ready.");
// Sanity-check: Test API for scrolling along y-axis works as expected.
promise_test(async(testInstance) => {
await resetScroll(testInstance);
await inject_wheel_scroll("down");
await waitForMinimumScrollOffset(testInstance, 0, 1);
assert_greater_than(window.scrollY, 0, "Expected vertical scroll.");
}, "Sanity-check: the page scrolls vertically in response to vertical wheel.");
// Sanity-check: Test API for scrolling along x-axis works as expected.
promise_test(async(testInstance) => {
await resetScroll(testInstance);
await inject_wheel_scroll("right");
await waitForMinimumScrollOffset(testInstance, 1, 0);
assert_greater_than(window.scrollX, 0, "Expected horizontal scroll.");
}, "Sanity-check: the page scrolls horizontally in response to horizontal wheel.");
// Test that when 'vertical-scroll' is enabled, vertical scroll can be
// blocked by canceling 'wheel' event.
promise_test(async(testInstance) => {
setFeatureState(iframeElement(), "vertical-scroll", "*");
await loadUrlInIframe(iframeElement(), url);
await resetScroll(testInstance);
await inject_wheel_scroll("down")
await waitFor(testInstance, no_scroll_timout);
assert_equals(window.scrollY, 0, "Did not expected vertical scroll.");
}, "When 'vertical-scroll' is enabled canceling vertical 'wheel' " +
"blocks vertical scrolling.");
// Test that when 'vertical-scroll' is disabled, vertical scroll cannot
// be blocked by canceling 'wheel' event.
promise_test(async(testInstance) => {
setFeatureState(iframeElement(), "vertical-scroll", "'none'");
await loadUrlInIframe(iframeElement(), url);
await resetScroll(testInstance);
await inject_wheel_scroll("down");
await waitForMinimumScrollOffset(testInstance, 0, 1);
assert_greater_than(window.scrollY, 0, "Expected vertical scroll.");
}, "When 'vertical-scroll' is disabled canceling vertical 'wheel' " +
"does not block vertical scrolling.");
// Test that when 'vertical-scroll' is disabled, horizontal scroll can be
// blocked by canceling 'wheel' event.
promise_test(async(testInstance) => {
setFeatureState(iframeElement(), "vertical-scroll", "'none'");
await loadUrlInIframe(iframeElement(), url);
await resetScroll(testInstance);
await inject_wheel_scroll("right");
await waitFor(testInstance, no_scroll_timout);
assert_equals(window.scrollX, 0, "Did not expect horizontal scroll.");
}, "When 'vertical-scroll' is disabled canceling horizontal 'wheel' " +
"blocks horizontal scrolling.");
</script>

View file

@ -1,3 +1,7 @@
// Feature test to avoid timeouts
function assert_feature_policy_supported() {
assert_not_equals(document.policy, undefined, 'Feature Policy is supported');
}
// Tests whether a feature that is enabled/disabled by feature policy works // Tests whether a feature that is enabled/disabled by feature policy works
// as expected. // as expected.
// Arguments: // Arguments:
@ -279,6 +283,7 @@ function test_allowed_feature_for_subframe(message, feature, src, allow) {
frame.allow = allow; frame.allow = allow;
} }
promise_test(function() { promise_test(function() {
assert_feature_policy_supported();
frame.src = src; frame.src = src;
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
window.addEventListener('message', function handler(evt) { window.addEventListener('message', function handler(evt) {
@ -305,6 +310,7 @@ function test_disallowed_feature_for_subframe(message, feature, src, allow) {
frame.allow = allow; frame.allow = allow;
} }
promise_test(function() { promise_test(function() {
assert_feature_policy_supported();
frame.src = src; frame.src = src;
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
window.addEventListener('message', function handler(evt) { window.addEventListener('message', function handler(evt) {
@ -333,6 +339,7 @@ function test_subframe_header_policy(
feature, frame_header_policy, src, test_expects, test_name) { feature, frame_header_policy, src, test_expects, test_name) {
let frame = document.createElement('iframe'); let frame = document.createElement('iframe');
promise_test(function() { promise_test(function() {
assert_feature_policy_supported()
frame.src = src + '?pipe=sub|header(Feature-Policy,' + feature + ' ' frame.src = src + '?pipe=sub|header(Feature-Policy,' + feature + ' '
+ frame_header_policy + ';)'; + frame_header_policy + ';)';
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {

View file

@ -4,11 +4,12 @@
promise_test(async() => { promise_test(async() => {
const text = await (await fetch("/interfaces/fetch.idl")).text(); const text = await (await fetch("/interfaces/fetch.idl")).text();
const referrer_policy = await (await fetch("/interfaces/webappsec-referrer-policy.idl")).text();
const idl_array = new IdlArray(); const idl_array = new IdlArray();
idl_array.add_idls(text); idl_array.add_idls(text);
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface AbortSignal {};"); idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface AbortSignal {};");
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ReadableStream {};"); idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ReadableStream {};");
idl_array.add_untested_idls("enum ReferrerPolicy {};"); idl_array.add_dependency_idls(referrer_policy);
idl_array.add_objects({ idl_array.add_objects({
Headers: ["new Headers()"], Headers: ["new Headers()"],
Request: ["new Request('about:blank')"], Request: ["new Request('about:blank')"],

View file

@ -8,7 +8,7 @@
.then(r => r.json()) .then(r => r.json())
.then(j => { .then(j => {
assert_header_equals(j.header, { assert_header_equals(j.header, {
"cause": "forced", "cause": undefined,
"destination": "\"\"", "destination": "\"\"",
"target": "subresource", "target": "subresource",
"site": "same-origin" "site": "same-origin"
@ -21,7 +21,7 @@
.then(r => r.json()) .then(r => r.json())
.then(j => { .then(j => {
assert_header_equals(j.header, { assert_header_equals(j.header, {
"cause": "forced", "cause": undefined,
"destination": "\"\"", "destination": "\"\"",
"target": "subresource", "target": "subresource",
"site": "same-site" "site": "same-site"
@ -34,7 +34,7 @@
.then(r => r.json()) .then(r => r.json())
.then(j => { .then(j => {
assert_header_equals(j.header, { assert_header_equals(j.header, {
"cause": "forced", "cause": undefined,
"destination": "\"\"", "destination": "\"\"",
"target": "subresource", "target": "subresource",
"site": "cross-site" "site": "cross-site"

View file

@ -12,7 +12,7 @@
"https://{{host}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py", "https://{{host}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py",
t.step_func_done(img => { t.step_func_done(img => {
assert_header_equals(decodeImageData(extractImageData(img)).headers["sec-metadata"], { assert_header_equals(decodeImageData(extractImageData(img)).headers["sec-metadata"], {
"cause": "forced", "cause": undefined,
"destination": "image", "destination": "image",
"target": "subresource", "target": "subresource",
"site": "same-origin" "site": "same-origin"
@ -27,7 +27,7 @@
"https://{{hosts[][www]}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py", "https://{{hosts[][www]}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py",
t.step_func_done(img => { t.step_func_done(img => {
assert_header_equals(decodeImageData(extractImageData(img)).headers["sec-metadata"], { assert_header_equals(decodeImageData(extractImageData(img)).headers["sec-metadata"], {
"cause": "forced", "cause": undefined,
"destination": "image", "destination": "image",
"target": "subresource", "target": "subresource",
"site": "same-site" "site": "same-site"
@ -42,7 +42,7 @@
"https://{{hosts[alt][www]}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py", "https://{{hosts[alt][www]}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py",
t.step_func_done(img => { t.step_func_done(img => {
assert_header_equals(decodeImageData(extractImageData(img)).headers["sec-metadata"], { assert_header_equals(decodeImageData(extractImageData(img)).headers["sec-metadata"], {
"cause": "forced", "cause": undefined,
"destination": "image", "destination": "image",
"target": "subresource", "target": "subresource",
"site": "cross-site" "site": "cross-site"

View file

@ -10,7 +10,7 @@
t.add_cleanup(_ => header = null); t.add_cleanup(_ => header = null);
assert_header_equals(header, { assert_header_equals(header, {
"cause": "forced", "cause": undefined,
"destination": "script", "destination": "script",
"target": "subresource", "target": "subresource",
"site": "same-origin" "site": "same-origin"
@ -25,7 +25,7 @@
t.add_cleanup(_ => header = null); t.add_cleanup(_ => header = null);
assert_header_equals(header, { assert_header_equals(header, {
"cause": "forced", "cause": undefined,
"destination": "script", "destination": "script",
"target": "subresource", "target": "subresource",
"site": "same-site" "site": "same-site"
@ -40,7 +40,7 @@
t.add_cleanup(_ => header = null); t.add_cleanup(_ => header = null);
assert_header_equals(header, { assert_header_equals(header, {
"cause": "forced", "cause": undefined,
"destination": "script", "destination": "script",
"target": "subresource", "target": "subresource",
"site": "cross-site" "site": "cross-site"

View file

@ -8,7 +8,7 @@
<script> <script>
"use strict"; "use strict";
run_fp_tests_disabled(GeolocationSensor); run_fp_tests_disabled('GeolocationSensor');
promise_test(async t => { promise_test(async t => {
await promise_rejects(t, 'SecurityError', GeolocationSensor.read()); await promise_rejects(t, 'SecurityError', GeolocationSensor.read());

View file

@ -8,6 +8,6 @@
<script> <script>
"use strict"; "use strict";
run_fp_tests_enabled_by_attribute_redirect_on_load(GeolocationSensor); run_fp_tests_enabled_by_attribute_redirect_on_load('GeolocationSensor');
</script> </script>
</body> </body>

View file

@ -8,6 +8,6 @@
<script> <script>
"use strict"; "use strict";
run_fp_tests_enabled_by_attribute(GeolocationSensor); run_fp_tests_enabled_by_attribute('GeolocationSensor');
</script> </script>
</body> </body>

View file

@ -8,6 +8,6 @@
<script> <script>
"use strict"; "use strict";
run_fp_tests_enabled(GeolocationSensor); run_fp_tests_enabled('GeolocationSensor');
</script> </script>
</body> </body>

View file

@ -8,6 +8,6 @@
<script> <script>
"use strict"; "use strict";
run_fp_tests_enabled_on_self_origin(GeolocationSensor); run_fp_tests_enabled_on_self_origin('GeolocationSensor');
</script> </script>
</body> </body>

View file

@ -8,6 +8,6 @@
<script src="/generic-sensor/generic-sensor-tests.js"></script> <script src="/generic-sensor/generic-sensor-tests.js"></script>
<script> <script>
runGenericSensorTests(GeolocationSensor); runGenericSensorTests('GeolocationSensor');
</script> </script>

View file

@ -14,6 +14,6 @@
</ol> </ol>
<script> <script>
runGenericSensorOnerror(GeolocationSensor); runGenericSensorOnerror('GeolocationSensor');
</script> </script>

View file

@ -1,19 +0,0 @@
<!DOCTYPE HTML>
<title>The textLengh IDL attribute</title>
<meta content="charset=utf-16">
<link rel="author" title="tigercosmos" href="mailto:phy.tiger@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-textarea-textlength">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<textarea id="textarea"></textarea>
<script>
var textarea = document.getElementById("textarea");
test(function () {
textarea.value= "Hello, World!";
assert_equals(textarea.textLength, 13);
textarea.value = "\u4f60\u597d\uff0c\u4e16\u754c\uff01"; //你好,世界!
assert_equals(textarea.textLength, 6);
}, "Textarea's 'testLength' should work for utf-16.");
</script>

View file

@ -0,0 +1,9 @@
import time
def main(request, response):
time.sleep(1.0);
return [("Content-type", "text/javascript")], """
var s = document.getElementById('script0');
s.innerText = 't.unreached_func("This should not be evaluated")();';
"""

View file

@ -0,0 +1,38 @@
<!doctype html>
<head>
<meta charset=utf-8>
<title>Modify HTMLScriptElement's text after #prepare-a-script</title>
<link rel=help href="https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var t = async_test("Modify inline script element's text " +
"after prepare-a-script before evaluation");
</script>
<!-- This is "a style sheet that is blocking scripts" and thus ... -->
<link rel="stylesheet" href="resources/slow.py"></link>
<script src="resources/script-text-modifications.py" async></script>
<!-- This inline script becomes a parser-blocking script, and thus
the async script above is evaluated after script0 is inserted into DOM,
prepare-a-script'ed, and before its evaluation. -->
<script id="script0">
t.step(() => {
// When this is evaluated after the stylesheet is loaded,
// script0's innerText is modified by the async script above,
// but the evaluated script is still the original script here,
// not what is overwritten, because "child text content" is taken in
// #prepare-a-script and passed to "creating a classic script".
var s = document.getElementById('script0');
assert_equals(s.innerText,
't.unreached_func("This should not be evaluated")();',
"<script>'s innerText should be already modified");
assert_equals(s.text,
't.unreached_func("This should not be evaluated")();',
"<script>'s text should be already modified");
t.done();
});
</script>

View file

@ -0,0 +1,31 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Resource Timing Level 2" spec.
// See: https://w3c.github.io/resource-timing/
[Exposed=(Window,Worker)]
interface PerformanceResourceTiming : PerformanceEntry {
readonly attribute DOMString initiatorType;
readonly attribute DOMString nextHopProtocol;
readonly attribute DOMHighResTimeStamp workerStart;
readonly attribute DOMHighResTimeStamp redirectStart;
readonly attribute DOMHighResTimeStamp redirectEnd;
readonly attribute DOMHighResTimeStamp fetchStart;
readonly attribute DOMHighResTimeStamp domainLookupStart;
readonly attribute DOMHighResTimeStamp domainLookupEnd;
readonly attribute DOMHighResTimeStamp connectStart;
readonly attribute DOMHighResTimeStamp connectEnd;
readonly attribute DOMHighResTimeStamp secureConnectionStart;
readonly attribute DOMHighResTimeStamp requestStart;
readonly attribute DOMHighResTimeStamp responseStart;
readonly attribute DOMHighResTimeStamp responseEnd;
readonly attribute unsigned long long transferSize;
readonly attribute unsigned long long encodedBodySize;
readonly attribute unsigned long long decodedBodySize;
[Default] object toJSON();
};
partial interface Performance {
void clearResourceTimings();
void setResourceTimingBufferSize(unsigned long maxSize);
attribute EventHandler onresourcetimingbufferfull;
};

View file

@ -0,0 +1,16 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Server Timing" spec.
// See: https://w3c.github.io/server-timing/
[Exposed=(Window,Worker)]
interface PerformanceServerTiming {
readonly attribute DOMString name;
readonly attribute DOMHighResTimeStamp duration;
readonly attribute DOMString description;
[Default] object toJSON();
};
[Exposed=(Window,Worker)]
partial interface PerformanceResourceTiming {
readonly attribute FrozenArray<PerformanceServerTiming> serverTiming;
};

View file

@ -0,0 +1,15 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the Referrer Policy spec.
// See https://w3c.github.io/webappsec-referrer-policy/
enum ReferrerPolicy {
"",
"no-referrer",
"no-referrer-when-downgrade",
"same-origin",
"origin",
"strict-origin",
"origin-when-cross-origin",
"strict-origin-when-cross-origin",
"unsafe-url"
};

View file

@ -1,5 +1,7 @@
// Copied from https://wicg.github.io/webusb/#idl-index minus the // GENERATED CONTENT - DO NOT EDIT
// definitions related to Permissions API integration which is unstable. // Content of this file was automatically extracted from the
// "WebUSB API" spec.
// See: https://wicg.github.io/webusb/
dictionary USBDeviceFilter { dictionary USBDeviceFilter {
unsigned short vendorId; unsigned short vendorId;
@ -14,7 +16,7 @@ dictionary USBDeviceRequestOptions {
required sequence<USBDeviceFilter> filters; required sequence<USBDeviceFilter> filters;
}; };
[Exposed=(DedicatedWorker, SharedWorker, Window), SecureContext] [Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext]
interface USB : EventTarget { interface USB : EventTarget {
attribute EventHandler onconnect; attribute EventHandler onconnect;
attribute EventHandler ondisconnect; attribute EventHandler ondisconnect;
@ -27,7 +29,7 @@ partial interface Navigator {
[SameObject] readonly attribute USB usb; [SameObject] readonly attribute USB usb;
}; };
[Exposed=(DedicatedWorker, SharedWorker), SecureContext] [Exposed=(DedicatedWorker,SharedWorker), SecureContext]
partial interface WorkerNavigator { partial interface WorkerNavigator {
[SameObject] readonly attribute USB usb; [SameObject] readonly attribute USB usb;
}; };
@ -38,13 +40,13 @@ dictionary USBConnectionEventInit : EventInit {
[ [
Constructor(DOMString type, USBConnectionEventInit eventInitDict), Constructor(DOMString type, USBConnectionEventInit eventInitDict),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBConnectionEvent : Event { interface USBConnectionEvent : Event {
[SameObject] readonly attribute USBDevice device; [SameObject] readonly attribute USBDevice device;
}; };
[Exposed=(DedicatedWorker, SharedWorker, Window)] [Exposed=(DedicatedWorker,SharedWorker,Window)]
interface USBDevice { interface USBDevice {
readonly attribute octet usbVersionMajor; readonly attribute octet usbVersionMajor;
readonly attribute octet usbVersionMinor; readonly attribute octet usbVersionMinor;
@ -108,7 +110,7 @@ dictionary USBControlTransferParameters {
[ [
Constructor(USBTransferStatus status, optional DataView? data), Constructor(USBTransferStatus status, optional DataView? data),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBInTransferResult { interface USBInTransferResult {
readonly attribute DataView? data; readonly attribute DataView? data;
@ -117,7 +119,7 @@ interface USBInTransferResult {
[ [
Constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0), Constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBOutTransferResult { interface USBOutTransferResult {
readonly attribute unsigned long bytesWritten; readonly attribute unsigned long bytesWritten;
@ -126,7 +128,7 @@ interface USBOutTransferResult {
[ [
Constructor(USBTransferStatus status, optional DataView? data), Constructor(USBTransferStatus status, optional DataView? data),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBIsochronousInTransferPacket { interface USBIsochronousInTransferPacket {
readonly attribute DataView? data; readonly attribute DataView? data;
@ -135,7 +137,7 @@ interface USBIsochronousInTransferPacket {
[ [
Constructor(sequence<USBIsochronousInTransferPacket> packets, optional DataView? data), Constructor(sequence<USBIsochronousInTransferPacket> packets, optional DataView? data),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBIsochronousInTransferResult { interface USBIsochronousInTransferResult {
readonly attribute DataView? data; readonly attribute DataView? data;
@ -144,7 +146,7 @@ interface USBIsochronousInTransferResult {
[ [
Constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0), Constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBIsochronousOutTransferPacket { interface USBIsochronousOutTransferPacket {
readonly attribute unsigned long bytesWritten; readonly attribute unsigned long bytesWritten;
@ -153,7 +155,7 @@ interface USBIsochronousOutTransferPacket {
[ [
Constructor(sequence<USBIsochronousOutTransferPacket> packets), Constructor(sequence<USBIsochronousOutTransferPacket> packets),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBIsochronousOutTransferResult { interface USBIsochronousOutTransferResult {
readonly attribute FrozenArray<USBIsochronousOutTransferPacket> packets; readonly attribute FrozenArray<USBIsochronousOutTransferPacket> packets;
@ -161,7 +163,7 @@ interface USBIsochronousOutTransferResult {
[ [
Constructor(USBDevice device, octet configurationValue), Constructor(USBDevice device, octet configurationValue),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBConfiguration { interface USBConfiguration {
readonly attribute octet configurationValue; readonly attribute octet configurationValue;
@ -171,7 +173,7 @@ interface USBConfiguration {
[ [
Constructor(USBConfiguration configuration, octet interfaceNumber), Constructor(USBConfiguration configuration, octet interfaceNumber),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBInterface { interface USBInterface {
readonly attribute octet interfaceNumber; readonly attribute octet interfaceNumber;
@ -182,7 +184,7 @@ interface USBInterface {
[ [
Constructor(USBInterface deviceInterface, octet alternateSetting), Constructor(USBInterface deviceInterface, octet alternateSetting),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBAlternateInterface { interface USBAlternateInterface {
readonly attribute octet alternateSetting; readonly attribute octet alternateSetting;
@ -206,7 +208,7 @@ enum USBEndpointType {
[ [
Constructor(USBAlternateInterface alternate, octet endpointNumber, USBDirection direction), Constructor(USBAlternateInterface alternate, octet endpointNumber, USBDirection direction),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBEndpoint { interface USBEndpoint {
readonly attribute octet endpointNumber; readonly attribute octet endpointNumber;
@ -214,3 +216,21 @@ interface USBEndpoint {
readonly attribute USBEndpointType type; readonly attribute USBEndpointType type;
readonly attribute unsigned long packetSize; readonly attribute unsigned long packetSize;
}; };
dictionary USBPermissionDescriptor : PermissionDescriptor {
sequence<USBDeviceFilter> filters;
};
dictionary AllowedUSBDevice {
required octet vendorId;
required octet productId;
DOMString serialNumber;
};
dictionary USBPermissionStorage {
sequence<AllowedUSBDevice> allowedDevices = [];
};
interface USBPermissionResult : PermissionStatus {
attribute FrozenArray<USBDevice> devices;
};

View file

@ -60,8 +60,8 @@ callback XRFrameRequestCallback = void (DOMHighResTimeStamp time, XRPresentation
}; };
enum XRFrameOfReferenceType { enum XRFrameOfReferenceType {
"headModel", "head-model",
"eyeLevel", "eye-level",
"stage", "stage",
}; };

View file

@ -135,5 +135,5 @@ function runPromiseTest(button, data, expectedCard = visaCredit, expectedAddress
<small> <small>
If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/OWNERS">owners</a>. and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
</small> </small>

View file

@ -105,5 +105,5 @@ function runManualTest(button, expected = {}) {
</ol> </ol>
<small> <small>
If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/OWNERS">owners</a>. and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
</small> </small>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test for PaymentMethodChangeEvent.methodDetails attribute</title>
<link rel="help" href="https://w3c.github.io/browser-payment-api/#dom-paymentmethodchangeevent-methoddetails">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";
test(() => {
const methodDetails = {
test: "pass"
}
const event = new PaymentMethodChangeEvent("test", {
methodName: "wpt-test",
methodDetails
});
assert_idl_attribute(event, "methodDetails");
const { test } = event.methodDetails;
assert_equals(test, "pass");
assert_equals(event.methodDetails, methodDetails);
}, "Must have a methodDetails IDL attribute, which is initialized with to the methodName dictionary value");

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test for PaymentMethodChangeEvent.methodName attribute</title>
<link rel="help" href="https://w3c.github.io/browser-payment-api/#dom-paymentmethodchangeevent-src">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";
test(() => {
const event = new PaymentMethodChangeEvent("test", {
methodName: "wpt-test",
});
assert_idl_attribute(event, "methodName");
const { methodName } = event;
assert_equals(methodName, "wpt-test");
}, "Must have a methodName IDL attribute, which is initialized with to the methodName dictionary value");

View file

@ -189,5 +189,5 @@ function testRecycleEvents({ textContent: testName }) {
</ol> </ol>
<small> <small>
If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/OWNERS">owners</a>. and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
</small> </small>

View file

@ -93,5 +93,5 @@ function testFireEvents(button) {
</ol> </ol>
<small> <small>
If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/OWNERS">owners</a>. and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
</small> </small>

View file

@ -183,5 +183,5 @@ function testFireEvent(button, updateDetails) {
<small> <small>
If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/OWNERS">owners</a>. and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
</small> </small>

View file

@ -265,5 +265,5 @@ function testBadUpdate(button, badDetails, expectedError, errorCode) {
</ol> </ol>
<small> <small>
If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/OWNERS">owners</a>. and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
</small> </small>

View file

@ -111,5 +111,5 @@ function testRequestIsUpdating(button) {
</ol> </ol>
<small> <small>
If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/OWNERS">owners</a>. and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
</small> </small>

View file

@ -162,5 +162,5 @@ async function runAbortTest(button) {
<small> <small>
If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/OWNERS">owners</a>. and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
</small> </small>

View file

@ -90,5 +90,5 @@ function testShippingOptionChanged() {
</ol> </ol>
<small> <small>
If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/OWNERS">owners</a>. and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
</small> </small>

View file

@ -88,5 +88,5 @@ function testShippingOptionChanged(button) {
</ol> </ol>
<small> <small>
If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/OWNERS">owners</a>. and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
</small> </small>

View file

@ -0,0 +1,70 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test for onpaymentmethodchange attribute</title>
<link rel="help" href="https://w3c.github.io/browser-payment-api/#onpaymentmethodchange-attribute">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";
const testMethod = Object.freeze({ supportedMethods: "not-a-real-method" });
const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" });
const defaultMethods = Object.freeze([testMethod, applePay]);
const defaultDetails = Object.freeze({
total: {
label: "Total",
amount: {
currency: "USD",
value: "1.00",
},
},
});
test(() => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
assert_idl_attribute(request, "onpaymentmethodchange");
}, "Must have a onpaymentmethodchange IDL attribute");
test(() => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
const ev = new Event("paymentmethodchange");
let didHandle = false;
request.onpaymentmethodchange = evt => {
assert_equals(ev, evt, "must be same event");
didHandle = true;
};
request.dispatchEvent(ev);
assert_true(didHandle, "event did not fire");
}, `onpaymentmethodchange attribute is a generic handler for "paymentmethodchange"`);
test(() => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
const ev = new PaymentMethodChangeEvent("paymentmethodchange");
let didHandle = false;
request.onpaymentmethodchange = evt => {
assert_equals(ev, evt, "must be same event");
didHandle = true;
};
request.dispatchEvent(ev);
assert_true(didHandle, "event did not fire");
}, `onpaymentmethodchange attribute is a handler for PaymentMethodChangeEvent`);
test(() => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
const ev = new PaymentMethodChangeEvent("paymentmethodchange", {
methodName: "test"
});
let didHandle = false;
let didListen = false;
request.onpaymentmethodchange = evt => {
assert_equals(ev, evt, "must be same event");
didHandle = true;
};
request.addEventListener("paymentmethodchange", evt => {
assert_equals(ev, evt, "must be same event");
didListen = true;
});
request.dispatchEvent(ev);
assert_true(didHandle, "onpaymentmethodchange did not receive the event");
assert_true(didListen, "addEventListener did not receive the event");
}, `onpaymentmethodchange attribute and listeners both work`);
</script>

View file

@ -192,5 +192,5 @@ function manualTest2(elem){
</ol> </ol>
<small> <small>
If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/OWNERS">owners</a>. and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
</small> </small>

Some files were not shown because too many files have changed in this diff Show more