|
1 | 1 | /* @flow */
|
2 | 2 | /* eslint max-lines: 0 */
|
3 | 3 |
|
4 |
| -import { wrapPromise, once, noop } from "@krakenjs/belter/src"; |
| 4 | +import { wrapPromise } from "@krakenjs/belter/src"; |
5 | 5 | import { FUNDING } from "@paypal/sdk-constants/src";
|
6 | 6 | import { ZalgoPromise } from "@krakenjs/zalgo-promise/src";
|
7 | 7 |
|
8 | 8 | import {
|
9 | 9 | createTestContainer,
|
10 | 10 | destroyTestContainer,
|
11 | 11 | IPHONE6_USER_AGENT,
|
12 |
| - getElementRecursive, |
13 |
| - assert, |
14 | 12 | } from "../common";
|
15 | 13 |
|
16 | 14 | describe(`paypal button component props`, () => {
|
@@ -234,196 +232,3 @@ describe(`paypal button component props`, () => {
|
234 | 232 | });
|
235 | 233 | });
|
236 | 234 | });
|
237 |
| - |
238 |
| -// describe.only(`paypal button props - PayPal app switch overlay`, () => { |
239 |
| -// beforeEach(() => { |
240 |
| -// createTestContainer(); |
241 |
| -// }); |
242 |
| - |
243 |
| -// afterEach(() => { |
244 |
| -// destroyTestContainer(); |
245 |
| -// }); |
246 |
| - |
247 |
| -// it("should call showPayPalAppSwitchOverlay and show the overlay", (done) => { |
248 |
| -// done = once(done); |
249 |
| - |
250 |
| -// window.paypal |
251 |
| -// .Buttons({ |
252 |
| -// test: { |
253 |
| -// flow: "popup", |
254 |
| -// action: "init", |
255 |
| -// onRender({ xprops }) { |
256 |
| -// xprops.showPayPalAppSwitchOverlay({ |
257 |
| -// close: noop, |
258 |
| -// focus: noop, |
259 |
| -// }); |
260 |
| -// assert.ok(getElementRecursive(".paypal-logo-paypal-rebrand")); |
261 |
| -// assert.ok(getElementRecursive(".paypal-logo-color-white")); |
262 |
| -// assert.ok(getElementRecursive(".paypal-checkout-message")); |
263 |
| -// assert.ok(getElementRecursive(".paypal-checkout-continue")); |
264 |
| - |
265 |
| -// xprops.hidePayPalAppSwitchOverlay({ close: noop }); |
266 |
| - |
267 |
| -// done(); |
268 |
| -// }, |
269 |
| -// }, |
270 |
| -// onApprove(): void { |
271 |
| -// return done(new Error("Expected onApprove to not be called")); |
272 |
| -// }, |
273 |
| -// onCancel(): void { |
274 |
| -// return done(new Error("Expected onCancel to not be called")); |
275 |
| -// }, |
276 |
| -// }) |
277 |
| -// .render("#testContainer"); |
278 |
| -// }); |
279 |
| - |
280 |
| -// it("should call showPayPalAppSwitchOverlay then show the overlay and call focus when continue is clicked", (done) => { |
281 |
| -// done = once(done); |
282 |
| - |
283 |
| -// window.paypal |
284 |
| -// .Buttons({ |
285 |
| -// test: { |
286 |
| -// flow: "popup", |
287 |
| -// action: "init", |
288 |
| -// onRender({ xprops }) { |
289 |
| -// let focusCalled = false; |
290 |
| - |
291 |
| -// xprops.showPayPalAppSwitchOverlay({ |
292 |
| -// close: noop, |
293 |
| -// focus: () => { |
294 |
| -// focusCalled = true; |
295 |
| -// }, |
296 |
| -// }); |
297 |
| - |
298 |
| -// getElementRecursive(".paypal-checkout-continue").click(); |
299 |
| - |
300 |
| -// if (!focusCalled) { |
301 |
| -// done(new Error("Expected focus function to be called")); |
302 |
| -// } |
303 |
| - |
304 |
| -// xprops.hidePayPalAppSwitchOverlay({ close: noop }); |
305 |
| - |
306 |
| -// done(); |
307 |
| -// }, |
308 |
| -// }, |
309 |
| -// onApprove(): void { |
310 |
| -// return done(new Error("Expected onApprove to not be called")); |
311 |
| -// }, |
312 |
| -// onCancel(): void { |
313 |
| -// return done(new Error("Expected onCancel to not be called")); |
314 |
| -// }, |
315 |
| -// }) |
316 |
| -// .render("#testContainer"); |
317 |
| -// }); |
318 |
| - |
319 |
| -// it("should remove the overlay when hidePayPalAppSwitchOverlay", (done) => { |
320 |
| -// done = once(done); |
321 |
| - |
322 |
| -// window.paypal |
323 |
| -// .Buttons({ |
324 |
| -// test: { |
325 |
| -// flow: "popup", |
326 |
| -// action: "init", |
327 |
| -// onRender({ xprops }) { |
328 |
| -// let closeCalled = false; |
329 |
| -// const close = () => { |
330 |
| -// closeCalled = true; |
331 |
| -// }; |
332 |
| - |
333 |
| -// xprops.showPayPalAppSwitchOverlay({ |
334 |
| -// close, |
335 |
| -// focus: noop, |
336 |
| -// }); |
337 |
| - |
338 |
| -// if (closeCalled) { |
339 |
| -// done( |
340 |
| -// new Error("Expected close function to not be called on render") |
341 |
| -// ); |
342 |
| -// } |
343 |
| - |
344 |
| -// xprops.hidePayPalAppSwitchOverlay({ close }); |
345 |
| - |
346 |
| -// if (!closeCalled) { |
347 |
| -// done(new Error("Expected close function to be called")); |
348 |
| -// } |
349 |
| - |
350 |
| -// // timeout is to allow time for animation to run for overlay removal |
351 |
| -// setTimeout(() => { |
352 |
| -// try { |
353 |
| -// if (getElementRecursive(".paypal-checkout-sandbox")) { |
354 |
| -// done( |
355 |
| -// new Error( |
356 |
| -// "Expected overlay to be removed from dom after close was called" |
357 |
| -// ) |
358 |
| -// ); |
359 |
| -// } |
360 |
| -// } catch { |
361 |
| -// // an error will be thrown if the overlay is not found, which means overlay was removed successfully |
362 |
| -// done(); |
363 |
| -// } |
364 |
| -// }, 300); |
365 |
| - |
366 |
| -// done(); |
367 |
| -// }, |
368 |
| -// }, |
369 |
| -// onApprove(): void { |
370 |
| -// return done(new Error("Expected onApprove to not be called")); |
371 |
| -// }, |
372 |
| -// onCancel(): void { |
373 |
| -// return done(new Error("Expected onCancel to not be called")); |
374 |
| -// }, |
375 |
| -// }) |
376 |
| -// .render("#testContainer"); |
377 |
| -// }); |
378 |
| - |
379 |
| -// it("should call showPayPalAppSwitchOverlay then show the app switch overlay and call close when X is clicked", (done) => { |
380 |
| -// done = once(done); |
381 |
| - |
382 |
| -// window.paypal |
383 |
| -// .Buttons({ |
384 |
| -// test: { |
385 |
| -// flow: "popup", |
386 |
| -// action: "init", |
387 |
| -// onRender({ xprops }) { |
388 |
| -// let closeCalled = false; |
389 |
| -// xprops.showPayPalAppSwitchOverlay({ |
390 |
| -// close: () => { |
391 |
| -// closeCalled = true; |
392 |
| -// }, |
393 |
| -// focus: noop, |
394 |
| -// }); |
395 |
| - |
396 |
| -// getElementRecursive(".paypal-checkout-close").click(); |
397 |
| - |
398 |
| -// if (!closeCalled) { |
399 |
| -// done(new Error("Expected close function to be called")); |
400 |
| -// } |
401 |
| - |
402 |
| -// // timeout is to allow time for animation to run for overlay removal |
403 |
| -// setTimeout(() => { |
404 |
| -// try { |
405 |
| -// if (getElementRecursive(".paypal-checkout-sandbox")) { |
406 |
| -// done( |
407 |
| -// new Error( |
408 |
| -// "Expected overlay to be removed from dom after close was called" |
409 |
| -// ) |
410 |
| -// ); |
411 |
| -// } |
412 |
| -// } catch { |
413 |
| -// // an error will be thrown if the overlay is not found, which means overlay was removed successfully |
414 |
| -// } |
415 |
| - |
416 |
| -// done(); |
417 |
| -// }, 300); |
418 |
| -// }, |
419 |
| -// }, |
420 |
| -// onApprove(): void { |
421 |
| -// return done(new Error("Expected onApprove to not be called")); |
422 |
| -// }, |
423 |
| -// onCancel(): void { |
424 |
| -// return done(new Error("Expected onCancel to not be called")); |
425 |
| -// }, |
426 |
| -// }) |
427 |
| -// .render("#testContainer"); |
428 |
| -// }); |
429 |
| -// }); |
0 commit comments