mirror of
https://github.com/servo/servo.git
synced 2025-08-26 07:38:21 +01:00
Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326
This commit is contained in:
parent
462c272380
commit
1f531f66ea
5377 changed files with 174916 additions and 84369 deletions
|
@ -0,0 +1,84 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf8">
|
||||
<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-complete()">
|
||||
<title>
|
||||
PaymentResponse.prototype.complete() method
|
||||
</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="helpers.js"></script>
|
||||
<script>
|
||||
async function runManualTest({ completeWith: result }, button) {
|
||||
button.disabled = true;
|
||||
const { response, request } = await getPaymentRequestResponse();
|
||||
promise_test(async () => {
|
||||
try {
|
||||
// We .complete() as normal, using the passed test value
|
||||
const promise = response.complete(result);
|
||||
assert_true(promise instanceof Promise, "returns a promise");
|
||||
const returnedValue = await promise;
|
||||
assert_equals(
|
||||
returnedValue,
|
||||
undefined,
|
||||
"Returned value must always be undefined"
|
||||
);
|
||||
// We now call .complete() again, to force an exception
|
||||
// because [[completeCalled]] is true.
|
||||
try {
|
||||
await response.complete(result);
|
||||
assert_unreached("Expected InvalidStateError to be thrown");
|
||||
} catch (err) {
|
||||
assert_equals(
|
||||
err.code,
|
||||
DOMException.INVALID_STATE_ERR,
|
||||
"Must throw an InvalidStateError"
|
||||
);
|
||||
}
|
||||
button.innerHTML = `✅ ${button.textContent}`;
|
||||
} catch (err) {
|
||||
button.innerHTML = `❌ ${button.textContent}`;
|
||||
assert_unreached("Unexpected exception: " + err.message);
|
||||
}
|
||||
}, button.textContent.trim());
|
||||
}
|
||||
</script>
|
||||
|
||||
<h2>
|
||||
Manual Tests for PaymentResponse.complete() - Please run in order!
|
||||
</h2>
|
||||
<p>
|
||||
Click on each button in sequence from top to bottom without refreshing the page.
|
||||
Each button will bring up the Payment Request UI window.
|
||||
</p>
|
||||
<p>
|
||||
When presented with the payment sheet, use any credit card select to "Pay".
|
||||
Also confirm any prompts that come up.
|
||||
</p>
|
||||
<ol>
|
||||
<li>
|
||||
<button onclick="runManualTest({completeWith: 'success'}, this)">
|
||||
If the value of the internal slot [[completeCalled]] is true,
|
||||
reject promise with an "InvalidStateError" DOMException.
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button onclick="runManualTest({completeWith: 'unknown'}, this)">
|
||||
Passing no argument defaults to "unknown",
|
||||
eventually closing the sheet and doesn't throw.
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button onclick="runManualTest({completeWith: 'success'}, this)">
|
||||
Passing "success" eventually closes the sheet and doesn't throw.
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button onclick="runManualTest({completeWith: 'fail'}, this).then(done)">
|
||||
Passing "fail" eventually closes the sheet and doesn't throw.
|
||||
</button>
|
||||
</li>
|
||||
</ol>
|
||||
<small>
|
||||
If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
|
||||
and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
|
||||
</small>
|
Loading…
Add table
Add a link
Reference in a new issue