Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Must throw on duplicate shippingOptions ids #7217

Merged
merged 2 commits into from
Sep 4, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions payment-request/payment-request-constructor.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,25 @@
assert_equals(request.shippingOption, null, "selected option must be null");
}, "If there are any duplicate shipping option ids, then there are no shipping options");

test(() => {
smokeTest();
const dupShipping1 = Object.assign({}, defaultShippingOption, {
selected: true,
id: "DUPLICATE",
label: "Fail 1",
});
const dupShipping2 = Object.assign({}, defaultShippingOption, {
selected: false,
id: "DUPLICATE",
label: "Fail 2"
});
const shippingOptions = [dupShipping1, defaultShippingOption, dupShipping2];
const details = Object.assign({}, defaultDetails, { shippingOptions });
assert_throws(new TypeError(), () => {
new PaymentRequest(defaultMethods, details);
}, "Expected to throw a TypeError because duplicate IDs");
}, "Throw when there are duplicate shippingOption ids, even if other values are different");

// Process payment details modifiers:
test(() => {
smokeTest();
Expand Down