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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 }], | 306 }], |
307 ['Undefined supportedMethods in modifiers should throw TypeError.', null, fu
nction() { | 307 ['Undefined supportedMethods in modifiers should throw TypeError.', null, fu
nction() { |
308 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(
), 'modifiers': [{'supportedMethods': undefined}]}) | 308 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(
), 'modifiers': [{'supportedMethods': undefined}]}) |
309 }], | 309 }], |
310 ['Empty supportedMethods in modifiers should throw TypeError.', null, functi
on() { | 310 ['Empty supportedMethods in modifiers should throw TypeError.', null, functi
on() { |
311 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(
), 'modifiers': [{'supportedMethods': []}]}) | 311 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(
), 'modifiers': [{'supportedMethods': []}]}) |
312 }], | 312 }], |
313 ['Absence of supportedMethods in modifiers should throw TypeError.', null, f
unction() { | 313 ['Absence of supportedMethods in modifiers should throw TypeError.', null, f
unction() { |
314 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(
), 'modifiers': [{'total': buildItem()}]}) | 314 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(
), 'modifiers': [{'total': buildItem()}]}) |
315 }], | 315 }], |
316 ['Empty modifiers should throw TypeError.', null, function() { | |
317 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(
), 'modifiers': []}) | |
318 }], | |
319 ['Empty details should throw', null, function() { | 316 ['Empty details should throw', null, function() { |
320 new PaymentRequest([{'supportedMethods': ['foo']}], {}) | 317 new PaymentRequest([{'supportedMethods': ['foo']}], {}) |
321 }], | 318 }], |
322 ['Null items should throw', new TypeError(), function() { | 319 ['Null items should throw', new TypeError(), function() { |
323 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(
), 'displayItems': null}); | 320 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(
), 'displayItems': null}); |
324 }], | 321 }], |
325 ['Null shipping options should throw', new TypeError(), function() { | 322 ['Null shipping options should throw', new TypeError(), function() { |
326 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(
), 'displayItems': [buildItem()], 'shippingOptions': null}); | 323 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(
), 'displayItems': [buildItem()], 'shippingOptions': null}); |
327 }], | 324 }], |
328 ['Undefined PaymentShippingType value for shppingType should throw a TypeErr
or', new TypeError(), function() { | 325 ['Undefined PaymentShippingType value for shppingType should throw a TypeErr
or', new TypeError(), function() { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 }], | 408 }], |
412 ['Null amount in ' + detailNames[i] + ' should throw', null, function()
{ | 409 ['Null amount in ' + detailNames[i] + ' should throw', null, function()
{ |
413 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': null}), {requestShipping: true}) | 410 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': null}), {requestShipping: true}) |
414 }], | 411 }], |
415 ['Undefined amount in ' + detailNames[i] + ' should throw', null, functi
on() { | 412 ['Undefined amount in ' + detailNames[i] + ' should throw', null, functi
on() { |
416 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': undefined}), {requestShipping: true}) | 413 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det
ailNames[i], {'value': undefined}), {requestShipping: true}) |
417 }], | 414 }], |
418 ]); | 415 ]); |
419 } | 416 } |
420 </script> | 417 </script> |
OLD | NEW |