Revision ad91075ffdead7446438c989400d86663fe79d20 authored by Anne van Kesteren on 12 April 2018, 11:25:13 UTC, committed by Anne van Kesteren on 12 April 2018, 11:25:13 UTC
Needed for https://github.com/whatwg/fetch/issues/664 and https://github.com/whatwg/fetch/pull/600.
1 parent 19a42b9
Raw File
interfaces.https.html
<!doctype html>
<meta charset=utf-8>
<title>Payment Request interface IDL tests</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>
<script>
promise_test(async () => {
  const urls =  ["/interfaces/dom.idl", "/interfaces/payment-request.idl"];
  const [dom, payment_request] = await Promise.all(
    urls.map(url => fetch(url).then(r => r.text())));
  const idlArray = new IdlArray();
  idlArray.add_untested_idls(dom);
  idlArray.add_idls(payment_request);

  // typedef EventHandler from HTML
  // https://html.spec.whatwg.org/#eventhandler
  idlArray.add_idls(`
    [TreatNonObjectAsNull]
    callback EventHandlerNonNull = any (Event event);
    typedef EventHandlerNonNull? EventHandler;
  `);
  const methods = "[{supportedMethods: 'foo'}]";
  const amount = "{currency: 'USD', value: '0'}";
  const details = `{total: {label: 'bar', amount: ${amount}} }`;
  idlArray.add_objects({
    PaymentRequest: [`new PaymentRequest(${methods}, ${details})`],
  });
  idlArray.test();
}, "Setup for Payment Request API IDL tests.");
</script>
back to top