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