summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/payment-request/idlharness.https.window.js
blob: 53ae47e892104a08e3de4f4483b7442dec2e7043 (plain)
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
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js

'use strict';

// https://w3c.github.io/payment-request/

idl_test(
  ['payment-request'],
  ['dom', 'html'],
  idlArray => {
    try {
      const methods = [
        {supportedMethods: 'basic-card'},
        {supportedMethods: 'https://apple.com/apple-pay'},
      ];
      const amount = {currency: 'USD', value: '0'};
      const details = {total: {label: 'label', amount: amount} };
      window.paymentRequest = new PaymentRequest(methods, details);
    } catch (e) {
      // Surfaced below when paymentRequest is undefined.
    }

    idlArray.add_objects({
      PaymentRequest: ['paymentRequest'],
      PaymentMethodChangeEvent: ['new PaymentMethodChangeEvent("paymentmethodchange")'],
      PaymentRequestUpdateEvent: ['new PaymentRequestUpdateEvent("paymentrequestupdate")'],
      MerchantValidationEvent: ['new MerchantValidationEvent("merchantvalidation")'],
    });
  }
);