blob: 4da935cc4f05dfa11105b4246efc57edbd9d5ba7 [file] [log] [blame]
<!doctype html>
<meta charset="utf8">
<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-payeremail">
<title>
PaymentResponse.prototype.payerEmail 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">
payerEmail attribute is null when options undefined.
</button>
</li>
<li>
<button id="button2">
payerEmail attribute is null when requestPayerEmail is undefined.
</button>
</li>
<li>
<button id="button3">
payerEmail attribute is null when requestPayerEmail is false.
</button>
</li>
<li>
<button id="button4">
payerEmail attribute is 'wpt@w3.org' when requestPayerEmail is true.
</button>
</li>
<li>
<button id="button5">
payerEmail attribute is 'wpt@w3.org' when requestPayerEmail is truthy.
</button>
</li>
</ol>
<script>
internals.mockPaymentCoordinator.setShippingAddress({ emailAddress: 'wpt@w3.org' });
async function runTests()
{
await runTest(document.getElementById("button1"), undefined, { payerEmail: null });
await runTest(document.getElementById("button2"), { requestPayerEmail: undefined }, { payerEmail: null });
await runTest(document.getElementById("button3"), { requestPayerEmail: false }, { payerEmail: null });
await runTest(document.getElementById("button4"), { requestPayerEmail: true }, { payerEmail: 'wpt@w3.org' });
await runTest(document.getElementById("button5"), { requestPayerEmail: 'yep' }, { payerEmail: 'wpt@w3.org' });
done();
}
runTests();
</script>