blob: f579dc05b8b3cf059d66db9c6c6f1d0fa906b964 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="/js-test-resources/ui-helper.js"></script>
<script src="/resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Test basic creation of an ApplePayError object.");
window.jsTestIsAsync = true;
function logAndShouldThrow(setup, test) {
debug("SETUP: " + setup)
eval(setup);
shouldThrow(test);
debug("")
}
function logAndShouldNotThrow(setup, test) {
debug("SETUP: " + setup)
eval(setup);
shouldNotThrow(test);
debug("")
}
function go() {
debug("Testing ApplePayError")
debug("");
logAndShouldThrow("", "new ApplePayError()")
logAndShouldThrow("", "new ApplePayError([])")
logAndShouldThrow("", "new ApplePayError('')")
logAndShouldNotThrow("", "new ApplePayError('unknown')")
logAndShouldNotThrow("", "new ApplePayError('shippingContactInvalid')")
logAndShouldNotThrow("", "new ApplePayError('billingContactInvalid')")
logAndShouldNotThrow("", "new ApplePayError('addressUnserviceable')")
logAndShouldNotThrow("", "new ApplePayError('couponCodeInvalid')")
logAndShouldNotThrow("", "new ApplePayError('couponCodeExpired')")
logAndShouldThrow("", "new ApplePayError('unknown', [])")
logAndShouldThrow("", "new ApplePayError('unknown', '')")
logAndShouldNotThrow("", "new ApplePayError('unknown', 'phoneNumber')")
logAndShouldNotThrow("", "new ApplePayError('unknown', 'emailAddress')")
logAndShouldNotThrow("", "new ApplePayError('unknown', 'name')")
logAndShouldNotThrow("", "new ApplePayError('unknown', 'phoneticName')")
logAndShouldNotThrow("", "new ApplePayError('unknown', 'postalAddress')")
logAndShouldNotThrow("", "new ApplePayError('unknown', 'addressLines')")
logAndShouldNotThrow("", "new ApplePayError('unknown', 'locality')")
logAndShouldNotThrow("", "new ApplePayError('unknown', 'postalCode')")
logAndShouldNotThrow("", "new ApplePayError('unknown', 'administrativeArea')")
logAndShouldNotThrow("", "new ApplePayError('unknown', 'country')")
logAndShouldNotThrow("", "new ApplePayError('unknown', 'countryCode')")
document.querySelector("button").remove();
finishJSTest();
}
window.onload = function() {
UIHelper.activateElement(document.querySelector("button"));
}
</script>
<button onclick='go()'>Go</button>
<script src="/resources/js-test-post.js"></script>
</body>
</html>