зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1487295 - Add defaults to PaymentMethodChangeEventInit's members. r=baku
This commit is contained in:
Родитель
02dbdb12a9
Коммит
15c023f206
|
@ -72,9 +72,7 @@ PaymentMethodChangeEvent::init(
|
|||
const PaymentMethodChangeEventInit& aEventInitDict)
|
||||
{
|
||||
mMethodName.Assign(aEventInitDict.mMethodName);
|
||||
if (aEventInitDict.mMethodDetails.WasPassed()) {
|
||||
mMethodDetails = aEventInitDict.mMethodDetails.Value();
|
||||
}
|
||||
mMethodDetails = aEventInitDict.mMethodDetails;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
class PaymentRequestUpdateEvent;
|
||||
struct PaymentMethodChangeEventInit;
|
||||
class PaymentMethodChangeEvent final : public PaymentRequestUpdateEvent
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -8,6 +8,6 @@ interface PaymentMethodChangeEvent : PaymentRequestUpdateEvent {
|
|||
};
|
||||
|
||||
dictionary PaymentMethodChangeEventInit : PaymentRequestUpdateEventInit {
|
||||
required DOMString methodName;
|
||||
object? methodDetails;
|
||||
DOMString methodName = "";
|
||||
object? methodDetails = null;
|
||||
};
|
||||
|
|
|
@ -620617,11 +620617,11 @@
|
|||
"testharness"
|
||||
],
|
||||
"payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html": [
|
||||
"a478c559d497e8dea9d471ce1e36427bfb741aa7",
|
||||
"ec0aa96dddb46b26617064ab54e9d02e2a588cbb",
|
||||
"testharness"
|
||||
],
|
||||
"payment-request/PaymentMethodChangeEvent/methodName-attribute.https.html": [
|
||||
"e6e0bf9a91971b3a20acf59cf27097281f0d2085",
|
||||
"176638c7852f6f0f8fd7a8c3dfefdf439a829d22",
|
||||
"testharness"
|
||||
],
|
||||
"payment-request/PaymentRequestUpdateEvent/constructor.http.html": [
|
||||
|
|
|
@ -19,4 +19,15 @@ test(() => {
|
|||
assert_equals(test, "pass");
|
||||
assert_equals(event.methodDetails, methodDetails);
|
||||
}, "Must have a methodDetails IDL attribute, which is initialized with to the methodName dictionary value");
|
||||
|
||||
test(() => {
|
||||
const event = new PaymentMethodChangeEvent("test");
|
||||
assert_equals(event.methodDetails, null, "methodDetails attribute must initialize to null");
|
||||
|
||||
const event2 = new PaymentMethodChangeEvent("test", { methodName: "basic-card" });
|
||||
assert_equals(event2.methodDetails, null, "methodDetails attribute must initialize to null");
|
||||
|
||||
const event3 = new PaymentMethodChangeEvent("test", {});
|
||||
assert_equals(event2.methodDetails, null, "methodDetails attribute must initialize to null");
|
||||
}, "The methodDetails member defaults to null");
|
||||
</script>
|
||||
|
|
|
@ -14,4 +14,15 @@ test(() => {
|
|||
const { methodName } = event;
|
||||
assert_equals(methodName, "wpt-test");
|
||||
}, "Must have a methodName IDL attribute, which is initialized with to the methodName dictionary value");
|
||||
|
||||
test(() => {
|
||||
const event = new PaymentMethodChangeEvent("test");
|
||||
assert_equals(event.methodName, "", "methodName attribute must initialize to empty string");
|
||||
|
||||
const event2 = new PaymentMethodChangeEvent("test", { methodDetails: {} });
|
||||
assert_equals(event2.methodName, "", "methodName attribute must initialize to empty string");
|
||||
|
||||
const event3 = new PaymentMethodChangeEvent("test", {});
|
||||
assert_equals(event3.methodName, "", "methodName attribute must initialize to empty string");
|
||||
}, "When no dictionary is passed, the methodName member defaults to the empty string");
|
||||
</script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче