methodDetails-attribute.https.html (1307B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Test for PaymentMethodChangeEvent.methodDetails attribute</title> 4 <link rel="help" href="https://w3c.github.io/browser-payment-api/#dom-paymentmethodchangeevent-methoddetails"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script> 8 "use strict"; 9 test(() => { 10 const methodDetails = { 11 test: "pass" 12 } 13 const event = new PaymentMethodChangeEvent("test", { 14 methodName: "wpt-test", 15 methodDetails 16 }); 17 assert_idl_attribute(event, "methodDetails"); 18 const { test } = event.methodDetails; 19 assert_equals(test, "pass"); 20 }, "Must have a methodDetails IDL attribute, which is initialized with to the methodName dictionary value"); 21 22 test(() => { 23 const event = new PaymentMethodChangeEvent("test"); 24 assert_equals(event.methodDetails, null, "methodDetails attribute must initialize to null"); 25 26 const event2 = new PaymentMethodChangeEvent("test", { methodName: "basic-card" }); 27 assert_equals(event2.methodDetails, null, "methodDetails attribute must initialize to null"); 28 29 const event3 = new PaymentMethodChangeEvent("test", {}); 30 assert_equals(event2.methodDetails, null, "methodDetails attribute must initialize to null"); 31 }, "The methodDetails member defaults to null"); 32 </script>