blob: cbdcf6cfad4bde471aa900186ea80f9ee9839928 [file] [log] [blame]
<!doctype html>
<meta charset="utf8">
<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-payerphone">
<title>
PaymentResponse.prototype.payerPhone attribute
</title>
<script src="/js-test-resources/ui-helper.js"></script>
<script src="/resources/payment-request.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/helpers.js"></script>
<ol>
<li>
<button id="button1">
payerPhone attribute is null when options is undefined.
</button>
</li>
<li>
<button id="button2">
payerPhone attribute is null when requestPayerPhone is undefined.
</button>
</li>
<li>
<button id="button3">
payerPhone attribute is null when requestPayerPhone is false.
</button>
</li>
<li>
<button id="button4">
payerPhone attribute is '+12345678910' when requestPayerPhone is true.
</button>
</li>
<li>
<button id="button5">
payerPhone attribute is '+12345678910' when requestPayerPhone is truthy.
</button>
</li>
</ol>
<script>
internals.mockPaymentCoordinator.setShippingAddress({ phoneNumber: '+12345678910' });
async function runTests()
{
await runTest(document.getElementById("button1"), undefined, { payerPhone: null });
await runTest(document.getElementById("button2"), { requestPayerPhone: undefined }, { payerPhone: null });
await runTest(document.getElementById("button3"), { requestPayerPhone: false }, { payerPhone: null });
await runTest(document.getElementById("button4"), { requestPayerPhone: true }, { payerPhone: '+12345678910' });
await runTest(document.getElementById("button5"), { requestPayerPhone: 'yep' }, { payerPhone: '+12345678910' });
done();
}
runTests();
</script>