mirror of
https://github.com/servo/servo.git
synced 2025-08-14 01:45:33 +01:00
Update web-platform-tests to revision abd18b3e018d25ed668d179c905b7869dca5e239
This commit is contained in:
parent
908a642063
commit
158f7eec0e
117 changed files with 2997 additions and 434 deletions
|
@ -1,12 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- Copyright © 2017 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
|
||||
<meta charset="utf-8">
|
||||
<title>Test for PaymentRequest.show() method</title>
|
||||
<link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
<button id="button"></button>
|
||||
<script>
|
||||
'use strict';
|
||||
const button = document.getElementById("button");
|
||||
const defaultMethods = Object.freeze([
|
||||
{ supportedMethods: "basic-card" },
|
||||
{ supportedMethods: "https://apple.com/apple-pay" }
|
||||
|
@ -27,4 +30,40 @@ promise_test(async t => {
|
|||
const acceptPromise = request.show();
|
||||
await promise_rejects(t, "SecurityError", acceptPromise);
|
||||
}, `Calling show() without being triggered by user interaction throws`);
|
||||
|
||||
promise_test(async t => {
|
||||
button.onclick = async () => {
|
||||
const request = new PaymentRequest(defaultMethods, defaultDetails);
|
||||
const acceptPromise = request.show(); // Sets state to "interactive"
|
||||
await promise_rejects(t, "InvalidStateError", request.show());
|
||||
await request.abort();
|
||||
await promise_rejects(t, "AbortError", acceptPromise);
|
||||
};
|
||||
await test_driver.click(button);
|
||||
}, "Throws if the promise [[state]] is not 'created'.");
|
||||
|
||||
promise_test(async t => {
|
||||
button.onclick = async () => {
|
||||
const request1 = new PaymentRequest(defaultMethods, defaultDetails);
|
||||
const request2 = new PaymentRequest(defaultMethods, defaultDetails);
|
||||
const acceptPromise1 = request1.show();
|
||||
const acceptPromise2 = request2.show();
|
||||
await promise_rejects(t, "AbortError", acceptPromise2);
|
||||
await request1.abort();
|
||||
await promise_rejects(t, "AbortError", acceptPromise1);
|
||||
};
|
||||
await test_driver.click(button);
|
||||
}, `If the user agent's "payment request is showing" boolean is true, then return a promise rejected with an "AbortError" DOMException.`);
|
||||
|
||||
promise_test(async t => {
|
||||
button.onclick = async () => {
|
||||
const request = new PaymentRequest(
|
||||
[{ supportedMethods: "this-is-not-supported" }],
|
||||
defaultDetails
|
||||
);
|
||||
const acceptPromise = request.show();
|
||||
await promise_rejects(t, "NotSupportedError", acceptPromise);
|
||||
};
|
||||
await test_driver.click(button);
|
||||
}, `If payment method consultation produces no supported method of payment, then return a promise rejected with a "NotSupportedError" DOMException.`);
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue