-
Notifications
You must be signed in to change notification settings - Fork 54
/
interfaces.https.html
32 lines (31 loc) · 1.17 KB
/
interfaces.https.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!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_untested_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>