Revision 6a8a912f1cd285b1a130fbb406dc5e76be08e625 authored by jgraham on 08 March 2018, 15:25:02 UTC, committed by GitHub on 08 March 2018, 15:25:02 UTC
mozdownload and mozinstall are now used to install Firefox. Therefore
they are required to run the |wpt install| command.
1 parent 7949111
Raw File
user-abort-algorithm-manual.https.html
<!doctype html>
<meta charset="utf8">
<link rel="help" href="https://w3c.github.io/payment-request/#user-aborts-the-payment-request-algorithm">
<title>
  User aborts the payment request algorithm.
</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({ explicit_done: true, explicit_timeout: true });

const validAmount = Object.freeze({
  currency: "USD",
  value: "1.0",
});
const validTotal = Object.freeze({
  label: "Total due",
  amount: validAmount,
});
const validMethod = Object.freeze({
  supportedMethods: "basic-card",
});
const validMethods = Object.freeze([validMethod]);
const validDetails = Object.freeze({
  total: validTotal,
});

test(() => {
  try {
    new PaymentRequest(validMethods, validDetails);
  } catch (err) {
    done();
    throw err;
  }
}, "Can construct a payment request (smoke test).");

async function runAbortTest(button) {
  button.disabled = true;
  const { textContent: testName } = button;
  promise_test(async t => {
    const request = new PaymentRequest(validMethods, validDetails);
    // Await the user to abort
    await promise_rejects(t, "AbortError", request.show());
    // [[state]] is now closed
    await promise_rejects(t, "InvalidStateError", request.show());
  }, testName.trim());
}
</script>
<h2>
   User aborts the payment request algorithm.
</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, abort the payment request
  (e.g., by hitting the esc key or pressing a UA provided button).
</p>
<ol>
  <li>
    <button onclick="runAbortTest(this); done();">
      If the user aborts, the UA must run the user aborts the payment request algorithm.
    </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>
back to top