Auto merge of #24770 - servo-wpt-sync:wpt_update_18-11-2019, r=servo-wpt-sync

Sync WPT with upstream (18-11-2019)

Automated downstream sync of changes from upstream as of 18-11-2019.
[no-wpt-sync]
r? @servo-wpt-sync
This commit is contained in:
bors-servo 2019-11-18 23:54:42 -05:00 committed by GitHub
commit 5c92fd84ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 448 additions and 82 deletions

View file

@ -7,6 +7,3 @@
[Revoke blob URL after creating Request, will fetch]
expected: FAIL
[Revoke blob URL after calling fetch, fetch should succeed]
expected: FAIL

View file

@ -14281,6 +14281,12 @@
{}
]
],
"payment-method-basic-card/billing-address-is-null-manual.https.html": [
[
"payment-method-basic-card/billing-address-is-null-manual.https.html",
{}
]
],
"payment-method-basic-card/empty-data-manual.https.html": [
[
"payment-method-basic-card/empty-data-manual.https.html",
@ -122235,6 +122241,30 @@
{}
]
],
"css/css-flexbox/select-element-zero-height-001.html": [
[
"css/css-flexbox/select-element-zero-height-001.html",
[
[
"/css/css-flexbox/select-element-zero-height-001-ref.html",
"=="
]
],
{}
]
],
"css/css-flexbox/select-element-zero-height-002.html": [
[
"css/css-flexbox/select-element-zero-height-002.html",
[
[
"/css/css-flexbox/select-element-zero-height-002-ref.html",
"=="
]
],
{}
]
],
"css/css-flexbox/table-as-item-auto-min-width.html": [
[
"css/css-flexbox/table-as-item-auto-min-width.html",
@ -199775,6 +199805,18 @@
{}
]
],
"css/vendor-imports/mozilla/mozilla-central-reftests/will-change/will-change-fixpos-cb-offset-path-1.html": [
[
"css/vendor-imports/mozilla/mozilla-central-reftests/will-change/will-change-fixpos-cb-offset-path-1.html",
[
[
"/css/vendor-imports/mozilla/mozilla-central-reftests/will-change/green-square-100-by-100-offset-ref.html",
"=="
]
],
{}
]
],
"css/vendor-imports/mozilla/mozilla-central-reftests/will-change/will-change-fixpos-cb-perspective-1.html": [
[
"css/vendor-imports/mozilla/mozilla-central-reftests/will-change/will-change-fixpos-cb-perspective-1.html",
@ -199907,6 +199949,18 @@
{}
]
],
"css/vendor-imports/mozilla/mozilla-central-reftests/will-change/will-change-stacking-context-offset-path-1.html": [
[
"css/vendor-imports/mozilla/mozilla-central-reftests/will-change/will-change-stacking-context-offset-path-1.html",
[
[
"/css/vendor-imports/mozilla/mozilla-central-reftests/will-change/green-square-100-by-100-ref.html",
"=="
]
],
{}
]
],
"css/vendor-imports/mozilla/mozilla-central-reftests/will-change/will-change-stacking-context-opacity-1.html": [
[
"css/vendor-imports/mozilla/mozilla-central-reftests/will-change/will-change-stacking-context-opacity-1.html",
@ -246726,6 +246780,12 @@
"css/css-flexbox/scrollbars-ref.html": [
[]
],
"css/css-flexbox/select-element-zero-height-001-ref.html": [
[]
],
"css/css-flexbox/select-element-zero-height-002-ref.html": [
[]
],
"css/css-flexbox/support/100x100-green.png": [
[]
],
@ -567017,6 +567077,22 @@
"0eca05bfc63f9522e6d624c35469ba69e7410968",
"reftest"
],
"css/css-flexbox/select-element-zero-height-001-ref.html": [
"37a102e0f605b575384de0a99601e77fd0f8a462",
"support"
],
"css/css-flexbox/select-element-zero-height-001.html": [
"e39461ef129e99baae52fe93f01773ab27d8e4ac",
"reftest"
],
"css/css-flexbox/select-element-zero-height-002-ref.html": [
"93222f70617378a33799224ede30a330f9933e7d",
"support"
],
"css/css-flexbox/select-element-zero-height-002.html": [
"6b6b92896bcca7451703baf1e432bf3d28430b34",
"reftest"
],
"css/css-flexbox/support/100x100-green.png": [
"25b76c3c6f216793a36b1f29287dafd993898c67",
"support"
@ -600814,7 +600890,7 @@
"testharness"
],
"css/css-transforms/animation/scale-interpolation.html": [
"e71b134ce5f94143127ba830e99d37c20a433313",
"29999d49ccf85b0e5d55cfa263754d90c8300675",
"testharness"
],
"css/css-transforms/animation/transform-interpolation-001.html": [
@ -600846,7 +600922,7 @@
"testharness"
],
"css/css-transforms/animation/translate-interpolation.html": [
"3d40863b3b4332799443433f1a470de0100956ce",
"1764df3e967088312af38d03e466adfaf2fa91fe",
"testharness"
],
"css/css-transforms/backface-visibility-hidden-001.html": [
@ -601786,7 +601862,7 @@
"testharness"
],
"css/css-transforms/parsing/scale-parsing-valid.html": [
"ac23a17b0133c271cb88d9579ebf33b93f4f502d",
"bbd443a717ab3c4acf1c7be52df4d92b9b8a9d03",
"testharness"
],
"css/css-transforms/parsing/transform-box-computed.html": [
@ -601826,7 +601902,7 @@
"testharness"
],
"css/css-transforms/parsing/translate-parsing-valid.html": [
"17699ccc1c2d6570a0f20c3c9442cfaf681369d2",
"f15fdf0c4fb4ad004db749f622747a0035dcc909",
"testharness"
],
"css/css-transforms/patternTransform/reference/svg-patternTransform-combination-ref.html": [
@ -632674,7 +632750,7 @@
"support"
],
"css/vendor-imports/mozilla/mozilla-central-reftests/will-change/reftest.list": [
"d3031a49b89da4fe0913e52d86f45413d3083c84",
"231532eac32c3fb038b04375b670a02a9d59288d",
"support"
],
"css/vendor-imports/mozilla/mozilla-central-reftests/will-change/will-change-fixpos-cb-contain-1.html": [
@ -632689,6 +632765,10 @@
"892e6d4541ac2e00a365ab22ef6e246a9b8ccd11",
"reftest"
],
"css/vendor-imports/mozilla/mozilla-central-reftests/will-change/will-change-fixpos-cb-offset-path-1.html": [
"0fe1ec1da798479cdf0c43d3d7f8ee506b796e47",
"reftest"
],
"css/vendor-imports/mozilla/mozilla-central-reftests/will-change/will-change-fixpos-cb-perspective-1.html": [
"4a394f9958fec7021c5eab39dcacbe31902fe6e5",
"reftest"
@ -632733,6 +632813,10 @@
"ae13ac6b668889785ba51e778ee64ab15df24379",
"reftest"
],
"css/vendor-imports/mozilla/mozilla-central-reftests/will-change/will-change-stacking-context-offset-path-1.html": [
"07277b66d92f74e0d8df1d934ff213efd78c9ab4",
"reftest"
],
"css/vendor-imports/mozilla/mozilla-central-reftests/will-change/will-change-stacking-context-opacity-1.html": [
"2bff6676a7171e9132f7d4168d5ee2ad7c3b0f62",
"reftest"
@ -654238,7 +654322,7 @@
"support"
],
"html/semantics/embedded-content/media-elements/track/track-element/cors/support/cors-tester.py": [
"1c27a0d14bde05c1fed0a731650cae8e929d96a2",
"7ec7b160115b0eee7ab711bc37d61a9750b0cd5d",
"support"
],
"html/semantics/embedded-content/media-elements/track/track-element/cors/support/remove-cookie.html": [
@ -678245,6 +678329,10 @@
"8b9fe78e2e4f50f11364246edc6c53941b0ad395",
"testharness"
],
"payment-method-basic-card/billing-address-is-null-manual.https.html": [
"3250e0a2c550e89b4744a34341e68cd2ae063cea",
"manual"
],
"payment-method-basic-card/empty-data-manual.https.html": [
"ba881ee2366c49aa15799767892c5ed847e41ac3",
"manual"

View file

@ -0,0 +1,7 @@
[scale-parsing-valid.html]
[e.style['scale'\] = "100 200 1" should set the property value]
expected: FAIL
[e.style['scale'\] = "100 100 1" should set the property value]
expected: FAIL

View file

@ -8,3 +8,12 @@
[e.style['translate'\] = "100px calc(10px - 10%)" should set the property value]
expected: FAIL
[e.style['translate'\] = "100px 200px 0px" should set the property value]
expected: FAIL
[e.style['translate'\] = "100px 0px 0px" should set the property value]
expected: FAIL
[e.style['translate'\] = "1px 2px 0" should set the property value]
expected: FAIL

View file

@ -0,0 +1,2 @@
[matchMedia-display-none-iframe.html]
expected: ERROR

View file

@ -3,3 +3,6 @@
[scroll-behavior: smooth on DIV element]
expected: FAIL
[Instant scrolling while doing history navigation.]
expected: FAIL

View file

@ -1,2 +0,0 @@
[contenttype_txt.html]
expected: CRASH

View file

@ -2,6 +2,7 @@
type: testharness
[single-byte-decoder.html?document]
expected: TIMEOUT
[ISO-8859-4: iso_8859-4:1988 (document.characterSet and document.inputEncoding)]
expected: FAIL

View file

@ -315,18 +315,12 @@
[<iframe>: combined response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;charset=gbk text/plain text/html]
[<iframe>: separate response Content-Type: text/html */*;charset=gbk]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;" text/plain]
[<iframe>: separate response Content-Type: text/html;x=" text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/html */*]
expected: FAIL
[<iframe>: separate response Content-Type: text/plain */*]
expected: FAIL
[<iframe>: combined response Content-Type: text/html */*;charset=gbk]
[<iframe>: separate response Content-Type: text/html;" \\" text/plain]
expected: FAIL

View file

@ -59,3 +59,6 @@
[separate text/javascript error]
expected: FAIL
[separate text/javascript;charset=windows-1252 text/javascript]
expected: FAIL

View file

@ -11,9 +11,3 @@
[X-Content-Type-Options%3A%20nosniff%0C]
expected: FAIL
[X-Content-Type-Options%3A%20%2Cnosniff]
expected: FAIL
[Content-Type-Options%3A%20nosniff]
expected: FAIL

View file

@ -1,4 +0,0 @@
[traverse_the_history_4.html]
[Multiple history traversals, last would be aborted]
expected: FAIL

View file

@ -1,4 +1,4 @@
[traverse_the_history_2.html]
[traverse_the_history_5.html]
[Multiple history traversals, last would be aborted]
expected: FAIL

View file

@ -22,13 +22,13 @@
expected: NOTRUN
[Access allowed if same-origin and both set document.domain to existing value.]
expected: TIMEOUT
expected: NOTRUN
[Access is not revoked to Document object when we stop being same effective script origin due to document.domain.]
expected: NOTRUN
[Access disallowed if same-origin but only one sets document.domain.]
expected: FAIL
expected: TIMEOUT
[Access evolves correctly for cross-origin objects when we join up via document.domain and then diverge again.]
expected: NOTRUN

View file

@ -1,4 +1,5 @@
[creating_browsing_context_test_01.html]
expected: TIMEOUT
[first argument: absolute url]
expected: FAIL
expected: TIMEOUT

View file

@ -1,5 +1,5 @@
[embedded-opener-remove-frame.html]
expected: CRASH
expected: TIMEOUT
[opener and "removed" embedded documents]
expected: FAIL

View file

@ -1,16 +1,20 @@
[supported-elements.html]
expected: TIMEOUT
[Contenteditable element should support autofocus]
expected: FAIL
[Element with tabindex should support autofocus]
expected: FAIL
expected: TIMEOUT
[Host element with delegatesFocus including no focusable descendants should be skipped]
expected: FAIL
expected: NOTRUN
[Area element should support autofocus]
expected: FAIL
expected: NOTRUN
[Host element with delegatesFocus should support autofocus]
expected: FAIL
expected: NOTRUN
[Non-HTMLElement should not support autofocus]
expected: NOTRUN

View file

@ -1,6 +1,6 @@
[iframe_sandbox_popups_escaping-1.html]
type: testharness
expected: TIMEOUT
expected: CRASH
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
expected: TIMEOUT

View file

@ -1,5 +1,5 @@
[form-double-submit-3.html]
expected: ERROR
[<button> should have the same double-submit protection as <input type=submit>]
expected: TIMEOUT
expected: FAIL

View file

@ -1,5 +1,5 @@
[form-double-submit.html]
expected: ERROR
[default submit action should supersede onclick submit()]
expected: TIMEOUT
expected: FAIL

View file

@ -1,5 +0,0 @@
[button-submit-children.html]
expected: TIMEOUT
[This test will pass if a form navigation successfully occurs when clicking a child element of a <button type=submit> element with a onclick event handler which prevents the default form submission and manually calls form.submit() instead.]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[script-onerror-insertion-point-2.html]
expected: TIMEOUT

View file

@ -0,0 +1,4 @@
[DOMContentLoaded-defer.html]
[The end: DOMContentLoaded and defer scripts]
expected: FAIL

View file

@ -1,5 +1,5 @@
[nested-context-navigations-iframe.html]
expected: CRASH
expected: TIMEOUT
[Test that iframe navigations are not observable by the parent, even after history navigations by the parent]
expected: FAIL

View file

@ -1,4 +1,5 @@
[realtimeanalyser-fft-scaling.html]
expected: TIMEOUT
[X 2048-point FFT peak position is not equal to 64. Got 0.]
expected: FAIL

View file

@ -0,0 +1,5 @@
[018.html]
expected: TIMEOUT
[origin of the script that invoked the method, javascript:]
expected: TIMEOUT

View file

@ -0,0 +1,4 @@
[WorkerGlobalScope-close.html]
[Test sending a message after closing.]
expected: FAIL

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<title>Reference: Select element in flexbox with zero height</title>
<link rel="author" title="Mozilla" href="https://mozilla.org">
<style>
.container {
height: 0px;
border: 1px dotted black;
}
</style>
<body>
<div class="container">
<select style="width:100%"><option>Hi</option></select>
</div>
</body>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<title>Select element in flexbox with zero height</title>
<link rel="author" title="Mozilla" href="https://mozilla.org">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1591925">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#content-size-suggestion">
<link rel="match" href="select-element-zero-height-001-ref.html">
<style>
.container {
display: flex;
flex-direction: column;
height: 0px;
border: 1px dotted black;
}
</style>
<body>
<div class="container">
<select><option>Hi</option></select>
</div>
</body>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<title>Reference: Select element with background color in flexbox with zero height</title>
<link rel="author" title="Mozilla" href="https://mozilla.org">
<style>
.container {
height: 0px;
border: 1px dotted black;
}
.with-background {
width: 100%;
background: lime;
}
</style>
<body>
<div class="container">
<select class="with-background"><option>Hi</option></select>
</div>
</body>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<title>Select element with background color in flexbox with zero height</title>
<link rel="author" title="Mozilla" href="https://mozilla.org">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1591925">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#content-size-suggestion">
<link rel="match" href="select-element-zero-height-002-ref.html">
<style>
.container {
display: flex;
flex-direction: column;
height: 0px;
border: 1px dotted black;
}
.with-background {
background: lime;
}
</style>
<body>
<div class="container">
<select class="with-background"><option>Hi</option></select>
</div>
</body>

View file

@ -92,12 +92,12 @@
from: '-10 5 1',
to: '1',
}, [
{at: -1, expect: '-21 9 1'},
{at: 0, expect: '-10 5 1'},
{at: 0.25, expect: '-7.25 4 1'},
{at: 0.75, expect: '-1.75 2 1'},
{at: -1, expect: '-21 9'},
{at: 0, expect: '-10 5'},
{at: 0.25, expect: '-7.25 4'},
{at: 0.75, expect: '-1.75 2'},
{at: 1, expect: '1'},
{at: 2, expect: '12 -3 1'},
{at: 2, expect: '12 -3'},
]);
// Handling of the none value.
@ -148,12 +148,12 @@
from: 'initial',
to: '2 0.5 1',
}, [
{at: -1, expect: '0 1.5 1'},
{at: -1, expect: '0 1.5'},
{at: 0, expect: 'none'},
{at: 0.25, expect: '1.25 0.875 1'},
{at: 0.75, expect: '1.75 0.625 1'},
{at: 1, expect: '2 0.5 1'},
{at: 2, expect: '3 0 1'},
{at: 0.25, expect: '1.25 0.875'},
{at: 0.75, expect: '1.75 0.625'},
{at: 1, expect: '2 0.5'},
{at: 2, expect: '3 0'},
]);
test_interpolation({
@ -161,12 +161,12 @@
from: '2 0.5 1',
to: 'initial',
}, [
{at: -1, expect: '3 0 1'},
{at: 0, expect: '2 0.5 1'},
{at: 0.25, expect: '1.75 0.6251 1'},
{at: 0.75, expect: '1.25 0.875 1'},
{at: -1, expect: '3 0'},
{at: 0, expect: '2 0.5'},
{at: 0.25, expect: '1.75 0.6251'},
{at: 0.75, expect: '1.25 0.875'},
{at: 1, expect: 'none'},
{at: 2, expect: '0 1.5 1'},
{at: 2, expect: '0 1.5'},
]);
@ -194,7 +194,7 @@
{at: 0, expect: '0.5 1 2'},
{at: 0.25, expect: '0.875 0.875 1.75'},
{at: 0.75, expect: '1.625 0.625 1.25'},
{at: 1, expect: '2 0.5 1'},
{at: 1, expect: '2 0.5'},
{at: 2, expect: '3.5 0 0'},
]);
@ -204,7 +204,7 @@
to: 'inherit',
}, [
{at: -1, expect: '3.5 0 0'},
{at: 0, expect: '2 0.5 1'},
{at: 0, expect: '2 0.5'},
{at: 0.25, expect: '1.625 0.625 1.25'},
{at: 0.75, expect: '0.875 0.875 1.75'},
{at: 1, expect: '0.5 1 2'},

View file

@ -9,14 +9,6 @@
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style>
body {
width: 500px;
height: 500px;
}
div {
width: 10px;
height: 10px;
}
.parent {
translate: 100px 200px 300px;
}

View file

@ -17,10 +17,10 @@ test_valid_value("scale", "1");
test_valid_value("scale", "100");
test_valid_value("scale", "100 100", "100");
test_valid_value("scale", "100 100 1");
test_valid_value("scale", "100 100 1", "100");
test_valid_value("scale", "100 200");
test_valid_value("scale", "100 200 1");
test_valid_value("scale", "100 200 1", "100 200");
test_valid_value("scale", "100 200 300");
</script>
</body>

View file

@ -23,14 +23,15 @@ test_valid_value("translate", "100px calc(10px - 10%)", "100px calc(10px - 10%)"
test_valid_value("translate", "100px 200%");
test_valid_value("translate", "100% 200px");
test_valid_value("translate", "100px 200px 0px");
test_valid_value("translate", "100px 200px 0px", "100px 200px");
test_valid_value("translate", "100px 0px 0px", "100px");
test_valid_value("translate", "100px 200px 300px");
test_valid_value("translate", "100% 200% 300px");
test_valid_value("translate", "calc(10% + 10px) calc(20% + 20px) calc(30em + 30px)");
test_valid_value("translate", "0", "0px");
test_valid_value("translate", "1px 2px 0", "1px 2px 0px");
test_valid_value("translate", "1px 2px 0", "1px 2px");
</script>
</body>
</html>

View file

@ -9,6 +9,7 @@
== will-change-stacking-context-position-1.html green-square-100-by-100-ref.html
== will-change-stacking-context-transform-1.html green-square-100-by-100-ref.html
== will-change-stacking-context-translate-1.html green-square-100-by-100-ref.html
== will-change-stacking-context-offset-path-1.html green-square-100-by-100-ref.html
== will-change-stacking-context-transform-style-1.html green-square-100-by-100-ref.html
== will-change-stacking-context-z-index-1.html green-square-100-by-100-ref.html
== will-change-fixpos-cb-contain-1.html green-square-100-by-100-offset-ref.html
@ -18,4 +19,5 @@
== will-change-fixpos-cb-position-1.html green-square-100-by-100-offset-ref.html
== will-change-fixpos-cb-transform-1.html green-square-100-by-100-offset-ref.html
== will-change-fixpos-cb-translate-1.html green-square-100-by-100-offset-ref.html
== will-change-fixpos-cb-offset-path-1.html green-square-100-by-100-offset-ref.html
== will-change-fixpos-cb-transform-style-1.html green-square-100-by-100-offset-ref.html

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS will-change: 'will-change: offset-path' creates a containing block for fixed positioned elements</title>
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-will-change-1/#will-change">
<link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
<link rel="match" href="green-square-100-by-100-offset-ref.html">
<meta name="assert" content="If any non-initial value of a property would cause the element to generate a containing block for fixed-position elements, specifying that property in will-change must cause the element to generate a containing block for fixed-position elements.">
<style>
html, body { margin: 0; padding: 0; }
div { width: 100px; height: 100px }
#wc { will-change: offset-path; margin: 100px 0 0 100px; background: red }
.child { top: 0; left: 0; width: 50px; background: green }
#fixpos { position: fixed }
#abspos { position: absolute; left: 50px }
</style>
<body>
<div id="wc">
<div class="child" id="fixpos">
</div>
<div class="child" id="abspos">
</div>
</div>
</body>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS will-change: 'will-change: offset-path' creates a stacking context</title>
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-will-change-1/#will-change">
<link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
<link rel="match" href="green-square-100-by-100-ref.html">
<meta name="assert" content="If any non-initial value of a property would create a stacking context on the element, specifying that property in will-change must create a stacking context on the element.">
<style>
html, body { margin: 0; padding: 0; }
div { width: 100px; height: 100px }
#wc { will-change: offset-path; background: red }
#child { position: absolute; top: 0; left: 0; z-index: -1; background: green }
</style>
<body>
<div id="wc">
<div id="child">
</div>
</div>
</body>

View file

@ -31,9 +31,9 @@ def main(request, response):
cors = request.headers.get("origin", "no")
cookie = request.cookies.first(id, "no")
line = 'cors = ' + cors + ' | cookie = ' + cookie.value;
cookie = request.cookies.first(id, None)
cookie_value = cookie.value if cookie is not None else "no"
line = 'cors = ' + cors + ' | cookie = ' + cookie_value;
data = request.server.stash.take(id)
if data is not None:

View file

@ -0,0 +1,150 @@
<!DOCTYPE html> <meta charset="utf-8" />
<title>Test for requesting billing address</title>
<link
rel="help"
href="https://github.com/w3c/payment-method-basic-card/pull/65"
/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({
explicit_done: true,
explicit_timeout: true,
});
const basicCard = { supportedMethods: "basic-card" };
const details = {
total: {
label: "label",
amount: { currency: "USD", value: "5.00" },
},
};
// Smoke tests
test(() => {
assert_true(
"onpaymentmethodchange" in PaymentRequest.prototype,
"The paymentmethodchange event handler is not supported on PaymentRequest"
);
assert_true(
"PaymentMethodChangeEvent" in window,
"The PaymentMethodChangeEvent is not supported"
);
}, "PaymentMethodChangeEvent support");
function dontRequestBillingAddress(options) {
promise_test(async t => {
const request = new PaymentRequest([basicCard], details, {
requestBillingAddress: false,
});
const showPromise = request.show();
// Let's check the method data from PaymentMethodChangeEvent.
const event = await new Promise(resolve =>
request.addEventListener("paymentmethodchange", resolve)
);
assert_true(
event instanceof PaymentMethodChangeEvent,
"Expected instance of PaymentMethodChangeEvent"
);
assert_equals(
event.methodDetails.billingAddress,
null,
"Expected methodDetails.billingAddress to be null"
);
// Let's check the billingAddress in the response
const response = await showPromise;
const {
details: { billingAddress: responseBillingAddress },
} = response;
assert_equals(
responseBillingAddress,
null,
"Expected PaymentResponse.data.billingAddress to be null"
);
// And we are done
await response.complete("success");
});
}
function requestBillingAddress() {
promise_test(async t => {
const request = new PaymentRequest([basicCard], details, {
requestBillingAddress: true,
});
const showPromise = request.show();
// Let's check the methodDetails from event.
const event = await new Promise(resolve =>
request.addEventListener("paymentmethodchange", resolve)
);
assert_true(
event instanceof PaymentMethodChangeEvent,
"Expected instance of PaymentMethodChangeEvent"
);
const { billingAddress: eventBillingAddress } = event.methodDetails;
checkRedactList(eventBillingAddress);
// Let's check the billingAddress in the response.
const response = await showPromise;
const {
details: { billingAddress: responseBillingAddress },
} = await showPromise;
checkRedactList(responseBillingAddress);
// And we are done.
await response.complete("success");
});
}
function checkRedaction(billingAddress) {
assert_true(
billingAddress instanceof PaymentAddress,
"Expected instance of PaymentAddress"
);
for (const item of ["organization", "phone", "recipient"]) {
assert_equals(
billingAddress[item],
"",
`Expected billingAddress's "${item}" attribute to equal null (redacted).`
);
}
}
</script>
<h2>Request billing address</h2>
<p>
Click on each button in sequence from top to bottom without refreshing the
page. Each button will bring up the Payment Request UI window.
</p>
<p>
When the payment sheet is presented, select a payment method (e.g., a credit
card), and press "Pay".
</p>
<ol>
<li>
<button onclick="dontRequestBillingAddress()">
When no billing address is requested,
`PaymentMethodChangeEvent.methodData.billingAddress` is null.
</button>
</li>
<li>
<button onclick="requestBillingAddress()">
When billing address is
requested,`PaymentMethodChangeEvent.methodData.billingAddress` is a
`PaymentAddress`.
</button>
</li>
<li><button onclick="done()">Done!</button></li>
</ol>
<small>
If you find a buggy test, please
<a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a> and
tag one of the
<a
href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml"
>suggested reviewers</a
>.
</small>