Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit d4b0b93

Browse files
Danyao Wangmarcoscaceres
authored andcommitted
Fix style - use double quotes consistently
1 parent 3abd809 commit d4b0b93

File tree

1 file changed

+59
-59
lines changed

1 file changed

+59
-59
lines changed

payment-request/payment-is-showing.https.html

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@
1111
<script src="/resources/testdriver.js"></script>
1212
<body>
1313
<script>
14-
'use strict';
14+
"use strict";
1515
const applePayMethod = {
16-
supportedMethods: 'https://apple.com/apple-pay',
16+
supportedMethods: "https://apple.com/apple-pay",
1717
data: {
1818
version: 3,
19-
merchantIdentifier: 'merchant.com.example',
20-
countryCode: 'US',
21-
merchantCapabilities: ['supports3DS'],
22-
supportedNetworks: ['visa'],
19+
merchantIdentifier: "merchant.com.example",
20+
countryCode: "US",
21+
merchantCapabilities: ["supports3DS"],
22+
supportedNetworks: ["visa"],
2323
},
2424
};
25-
const methods = [{supportedMethods: 'basic-card'}, applePayMethod];
25+
const methods = [{supportedMethods: "basic-card"}, applePayMethod];
2626
const details = {
2727
total: {
28-
label: 'Total',
28+
label: "Total",
2929
amount: {
30-
currency: 'USD',
31-
value: '1.00',
30+
currency: "USD",
31+
value: "1.00",
3232
},
3333
},
3434
};
@@ -39,13 +39,13 @@
3939
* @param {String} src Optional resource URL to load.
4040
* @returns {Promise} Resolves when the src loads.
4141
*/
42-
async function attachIframe(src = 'blank.html') {
43-
const iframe = document.createElement('iframe');
42+
async function attachIframe(src = "blank.html") {
43+
const iframe = document.createElement("iframe");
4444
iframe.allowPaymentRequest = true;
4545
iframe.src = src;
4646
document.body.appendChild(iframe);
4747
await new Promise(resolve => {
48-
iframe.addEventListener('load', resolve, {once: true});
48+
iframe.addEventListener("load", resolve, {once: true});
4949
});
5050
return iframe;
5151
}
@@ -56,10 +56,10 @@
5656
* @param {String} src Optional resource URL to load.
5757
* @returns {Promise} Resolves when the src loads.
5858
*/
59-
async function loadPopupInsideUserGesture(src = 'blank.html') {
60-
const popupWindow = window.open(src, '', 'width=400,height=400');
59+
async function loadPopupInsideUserGesture(src = "blank.html") {
60+
const popupWindow = window.open(src, "", "width=400,height=400");
6161
await new Promise(resolve => {
62-
popupWindow.addEventListener('load', resolve, {once: true});
62+
popupWindow.addEventListener("load", resolve, {once: true});
6363
});
6464
popupWindow.focus();
6565
return popupWindow;
@@ -73,24 +73,24 @@
7373
// showing boolean" to true and then try to show a second payment sheet in
7474
// the same window. The second show() should reject.
7575
const [showPromise1, showPromise2] = await test_driver.bless(
76-
'testing one payment sheet per window',
76+
"testing one payment sheet per window",
7777
() => {
7878
return [request1.show(), request2.show()];
7979
},
8080
);
8181
await promise_rejects(
8282
t,
83-
'AbortError',
83+
"AbortError",
8484
showPromise2,
85-
'Attempting to show a second payment request must reject.',
85+
"Attempting to show a second payment request must reject.",
8686
);
8787

8888
await request1.abort();
8989
await promise_rejects(
9090
t,
91-
'AbortError',
91+
"AbortError",
9292
showPromise1,
93-
'request1 was aborted via .abort()',
93+
"request1 was aborted via .abort()",
9494
);
9595

9696
// Finally, request2 should have been "closed", so trying to show
@@ -99,17 +99,17 @@
9999
const rejectedPromise = request2.show();
100100
await promise_rejects(
101101
t,
102-
'InvalidStateError',
102+
"InvalidStateError",
103103
rejectedPromise,
104-
'Attempting to show a second payment request must reject.',
104+
"Attempting to show a second payment request must reject.",
105105
);
106106
// Finally, we confirm that request2's returned promises are unique.
107107
assert_not_equals(
108108
showPromise2,
109109
rejectedPromise,
110-
'Returned Promises be unique',
110+
"Returned Promises be unique",
111111
);
112-
}, 'The top browsing context can only show one payment sheet at a time.');
112+
}, "The top browsing context can only show one payment sheet at a time.");
113113

114114
promise_test(async t => {
115115
const iframe = await attachIframe();
@@ -121,7 +121,7 @@
121121

122122
// Let's get some blessed showPromises
123123
const [showPromise] = await test_driver.bless(
124-
'testing top window show() blocked by payment sheet in iframe',
124+
"testing top window show() blocked by payment sheet in iframe",
125125
() => {
126126
// iframe sets "is showing boolean", ignore the returned promise.
127127
iframeRequest.show();
@@ -132,9 +132,9 @@
132132

133133
await promise_rejects(
134134
t,
135-
'AbortError',
135+
"AbortError",
136136
showPromise,
137-
'iframe is already showing a payment request.',
137+
"iframe is already showing a payment request.",
138138
);
139139

140140
// Cleanup
@@ -154,7 +154,7 @@
154154
// windowRequest.show() sets "is showing boolean" to true. Then we try to
155155
// show a payment request in the iframe, which should reject.
156156
const [iframeShowPromise] = await test_driver.bless(
157-
'testing iframe show() blocked by payment sheet in top window',
157+
"testing iframe show() blocked by payment sheet in top window",
158158
() => {
159159
windowRequest.show();
160160
return [iframeRequest.show()];
@@ -163,15 +163,15 @@
163163

164164
await promise_rejects(
165165
t,
166-
'AbortError',
166+
"AbortError",
167167
iframeShowPromise,
168-
'The top window is already showing a payment request.',
168+
"The top window is already showing a payment request.",
169169
);
170170

171171
// Cleanup
172172
await windowRequest.abort();
173173
iframe.remove();
174-
}, 'An iframe cannot show a payment request if the top-level window is already showing one.');
174+
}, "An iframe cannot show a payment request if the top-level window is already showing one.");
175175

176176
promise_test(async t => {
177177
// Create a PaymentReuqest in top-level window.
@@ -186,7 +186,7 @@
186186
popupShowPromise,
187187
windowShowPromise,
188188
] = await test_driver.bless(
189-
'testing top-level show() blocked by payment sheet in popup',
189+
"testing top-level show() blocked by payment sheet in popup",
190190
async () => {
191191
const popupWindow = await loadPopupInsideUserGesture();
192192
const popupRequest = new popupWindow.PaymentRequest(methods, details);
@@ -205,11 +205,11 @@
205205

206206
await promise_rejects(
207207
t,
208-
'AbortError',
208+
"AbortError",
209209
windowShowPromise,
210210
"Expected window's showPromise to reject, request is already showing",
211211
);
212-
}, 'Using a popup window prevents the top-browsing context from showing a payment request');
212+
}, "Using a popup window prevents the top-browsing context from showing a payment request");
213213

214214
promise_test(async t => {
215215
const iframe = await attachIframe();
@@ -222,7 +222,7 @@
222222
// Open a popup window
223223
const [popupWindow, popupRequest] =
224224
await test_driver.bless(
225-
'open popup to test multiple context and window calls show() first',
225+
"open popup to test multiple context and window calls show() first",
226226
async () => {
227227
const popupWindow = await loadPopupInsideUserGesture();
228228
const popupRequest = new popupWindow.PaymentRequest(methods, details);
@@ -238,7 +238,7 @@
238238
popupShowPromise,
239239
iframeShowPromise,
240240
] = await test_driver.bless(
241-
'test multiple nested browsing context',
241+
"test multiple nested browsing context",
242242
() => {
243243
return [
244244
windowRequest.show(),
@@ -250,16 +250,16 @@
250250
// popupRequest and iframeRequest will both reject
251251
await promise_rejects(
252252
t,
253-
'AbortError',
253+
"AbortError",
254254
popupShowPromise,
255-
'Expected popupShowPromise to reject, request is already showing.',
255+
"Expected popupShowPromise to reject, request is already showing.",
256256
);
257257

258258
await promise_rejects(
259259
t,
260-
'AbortError',
260+
"AbortError",
261261
iframeShowPromise,
262-
'Expected iframeShowPromise to reject, request is already showing.',
262+
"Expected iframeShowPromise to reject, request is already showing.",
263263
);
264264

265265
await windowRequest.abort();
@@ -283,7 +283,7 @@
283283
windowShowPromise,
284284
iframeShowPromise
285285
] = await test_driver.bless(
286-
'test multiple browsing context and iframe calls show() first',
286+
"test multiple browsing context and iframe calls show() first",
287287
async () => {
288288
const popupWindow = await loadPopupInsideUserGesture();
289289
const popupRequest = new popupWindow.PaymentRequest(methods, details);
@@ -300,16 +300,16 @@
300300
// windowShowPromise and iframeRequest will both reject
301301
await promise_rejects(
302302
t,
303-
'AbortError',
303+
"AbortError",
304304
windowShowPromise,
305-
'Expected windowShowPromise to reject, the popup is showing a payment request.',
305+
"Expected windowShowPromise to reject, the popup is showing a payment request.",
306306
);
307307

308308
await promise_rejects(
309309
t,
310-
'AbortError',
310+
"AbortError",
311311
iframeShowPromise,
312-
'Expected iframeShowPromise to reject, the popup is showing a payment request.',
312+
"Expected iframeShowPromise to reject, the popup is showing a payment request.",
313313
);
314314

315315
await popupRequest.abort();
@@ -326,7 +326,7 @@
326326
const iframeRequest = new iframeWindow.PaymentRequest(methods, details);
327327

328328
const [popupWindow, popupRequest] = await test_driver.bless(
329-
'open popup to test multiple context and iframe calls show() first',
329+
"open popup to test multiple context and iframe calls show() first",
330330
async () => {
331331
const w = await loadPopupInsideUserGesture();
332332
const r = new w.PaymentRequest(methods, details);
@@ -342,7 +342,7 @@
342342
popupShowPromise,
343343
windowShowPromise,
344344
] = await test_driver.bless(
345-
'test multiple browsing context and iframe calls show() first',
345+
"test multiple browsing context and iframe calls show() first",
346346
async () => {
347347
return [
348348
iframeRequest.show(),
@@ -355,16 +355,16 @@
355355
// windowShowPromise and iframeRequest will both reject
356356
await promise_rejects(
357357
t,
358-
'AbortError',
358+
"AbortError",
359359
windowShowPromise,
360-
'Expected windowShowPromise to reject, the popup is showing a payment request.',
360+
"Expected windowShowPromise to reject, the popup is showing a payment request.",
361361
);
362362

363363
await promise_rejects(
364364
t,
365-
'AbortError',
365+
"AbortError",
366366
popupShowPromise,
367-
'Expected popupShowPromise to reject, the popup is showing a payment request.',
367+
"Expected popupShowPromise to reject, the popup is showing a payment request.",
368368
);
369369

370370
await iframeRequest.abort();
@@ -377,19 +377,19 @@
377377
const iframeWindow = iframe.contentWindow;
378378
const iframeRequest = new iframeWindow.PaymentRequest(methods, details);
379379
const iframeShowPromise = test_driver.bless(
380-
'test navigating iframe after show()',
380+
"test navigating iframe after show()",
381381
() => iframeRequest.show(),
382382
);
383383

384384
// We navigate away, causing the payment sheet to close
385385
// and the request is showing boolean to become false.
386-
iframe.src = 'blank.html?abc=123';
386+
iframe.src = "blank.html?abc=123";
387387
await new Promise(resolve => (iframe.onload = resolve));
388388
await promise_rejects(
389389
t,
390-
'AbortError',
390+
"AbortError",
391391
iframeShowPromise,
392-
'Navigating iframe away must cause the iframeShowPromise to reject.',
392+
"Navigating iframe away must cause the iframeShowPromise to reject.",
393393
);
394394
iframe.remove();
395395

@@ -402,7 +402,7 @@
402402
promise_test(async t => {
403403
const [popupWindow, popupRequest, popupShowPromise] =
404404
await test_driver.bless(
405-
'trigger payment in a popup window',
405+
"trigger payment in a popup window",
406406
async () => {
407407
const popupWindow = await loadPopupInsideUserGesture();
408408
const popupRequest = new popupWindow.PaymentRequest(methods, details);
@@ -411,15 +411,15 @@
411411

412412
// We navigate away, causing the payment sheet to close
413413
// and the request is showing boolean to become false.
414-
popupWindow.location = 'blank.html?abc=123';
414+
popupWindow.location = "blank.html?abc=123";
415415
await new Promise(resolve => (popupWindow.onload = resolve));
416416

417417
// Don't wait for |popupShowPromise| to reject because it may never do
418418
// (see https://github.com/w3c/payment-request/issues/872). Instead, try
419419
// to spin up a new payment request and make sure it succeeds.
420420
const request = new window.PaymentRequest(methods, details);
421421
const [showPromise] = await test_driver.bless(
422-
'trigger payment in main window',
422+
"trigger payment in main window",
423423
() => {
424424
return [request.show()];
425425
});

0 commit comments

Comments
 (0)