OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset="utf-8"> | 2 <meta charset="utf-8"> |
3 <title>Tests for PaymentRequest interface</title> | 3 <title>Tests for PaymentRequest interface</title> |
4 <script src="../resources/testharness.js"></script> | 4 <script src="../resources/testharness.js"></script> |
5 <script src="../resources/testharnessreport.js"></script> | 5 <script src="../resources/testharnessreport.js"></script> |
6 <script> | 6 <script> |
7 function substitute(originalObject, substituteKeyValuePairs) { | 7 function substitute(originalObject, substituteKeyValuePairs) { |
8 for (var key in originalObject) { | 8 for (var key in originalObject) { |
9 if (originalObject.hasOwnProperty(key) && substituteKeyValuePairs.hasOwn
Property(key)) { | 9 if (originalObject.hasOwnProperty(key) && substituteKeyValuePairs.hasOwn
Property(key)) { |
10 originalObject[key] = substituteKeyValuePairs[key]; | 10 originalObject[key] = substituteKeyValuePairs[key]; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 }], | 197 }], |
198 ['Empty supported payment method identifiers should throw TypeError.', null,
function() { | 198 ['Empty supported payment method identifiers should throw TypeError.', null,
function() { |
199 new PaymentRequest([{'supportedMethods': []}], buildDetails()) | 199 new PaymentRequest([{'supportedMethods': []}], buildDetails()) |
200 }], | 200 }], |
201 ['Duplicate supported payment method identifiers should throw TypeError.', n
ull, function() { | 201 ['Duplicate supported payment method identifiers should throw TypeError.', n
ull, function() { |
202 new PaymentRequest([{'supportedMethods': ['foo', 'foo']}], buildDetails(
), {}) | 202 new PaymentRequest([{'supportedMethods': ['foo', 'foo']}], buildDetails(
), {}) |
203 }], | 203 }], |
204 ['Duplicate supported payment method identifiers should throw TypeError.', n
ull, function() { | 204 ['Duplicate supported payment method identifiers should throw TypeError.', n
ull, function() { |
205 new PaymentRequest([{'supportedMethods': ['foo']}, {'supportedMethods':
['foo']}], buildDetails(), {}) | 205 new PaymentRequest([{'supportedMethods': ['foo']}, {'supportedMethods':
['foo']}], buildDetails(), {}) |
206 }], | 206 }], |
| 207 ['Duplicate shipping option identifiers should throw TypeError.', null, func
tion() { |
| 208 var shippingOptions = [buildItem({'id': 'express', 'selected': false}),
buildItem({'id': 'express', 'selected': true})]; |
| 209 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(
), 'displayItems': [buildItem()], 'shippingOptions': shippingOptions}, {'request
Shipping': true}) |
| 210 }], |
207 ['Absence of total should throw TypeError.', null, function() { | 211 ['Absence of total should throw TypeError.', null, function() { |
208 new PaymentRequest([{'supportedMethods': ['foo']}], {'displayItems': [bu
ildItem()]}) | 212 new PaymentRequest([{'supportedMethods': ['foo']}], {'displayItems': [bu
ildItem()]}) |
209 }], | 213 }], |
210 ['Negative total value should throw a TypeError.', null, function() { | 214 ['Negative total value should throw a TypeError.', null, function() { |
211 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails('total'
, {'value': '-0.01'})) | 215 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails('total'
, {'value': '-0.01'})) |
212 }], | 216 }], |
213 ['Duplicate supported payment method identifiers in modifiers should throw T
ypeError.', null, function() { | 217 ['Duplicate supported payment method identifiers in modifiers should throw T
ypeError.', null, function() { |
214 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(
), 'modifiers': [{'supportedMethods': ['foo', 'foo']}]}) | 218 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(
), 'modifiers': [{'supportedMethods': ['foo', 'foo']}]}) |
215 }], | 219 }], |
216 ['Duplicate supported payment method identifiers in modifiers should throw T
ypeError.', null, function() { | 220 ['Duplicate supported payment method identifiers in modifiers should throw T
ypeError.', null, function() { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 }], | 336 }], |
333 ['Null amount should throw', null, function() { | 337 ['Null amount should throw', null, function() { |
334 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': null})) | 338 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': null})) |
335 }], | 339 }], |
336 ['Undefined amount should throw', null, function() { | 340 ['Undefined amount should throw', null, function() { |
337 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': undefined})) | 341 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': undefined})) |
338 }], | 342 }], |
339 ]); | 343 ]); |
340 } | 344 } |
341 </script> | 345 </script> |
OLD | NEW |