|
371 | 371 | });
|
372 | 372 | asyncTest( "overlay panel should not call getWrapper", function(){
|
373 | 373 | expect( 5 );
|
374 |
| - var testPanel = $( "#panel-test-get-wrapper-overlay" ); |
| 374 | + var eventNs = ".overlayPanelShouldNotCallGetWrapper", |
| 375 | + testPanel = $( "#panel-test-get-wrapper-overlay" ); |
375 | 376 |
|
376 | 377 | testPanel.panel({
|
377 | 378 | "display": "overlay"
|
378 | 379 | });
|
379 |
| - ok( count === 0, "getWrapper only called once durring create" ); |
380 |
| - testPanel.panel( "open" ); |
381 |
| - testPanel.one( "panelopen", function(){ |
382 |
| - ok( count === 0, "getWrapper not called on open" ); |
383 |
| - }); |
384 |
| - testPanel.panel( "close" ); |
385 |
| - testPanel.one( "panelclose", function(){ |
386 |
| - ok( count === 0, "getWrapper not called on close" ); |
387 |
| - $.mobile.changePage( "#page2" ); |
388 |
| - }); |
389 |
| - $( "body" ).one( "pagechange", function(){ |
390 |
| - ok( count === 0, "getWrapper not called on pagechange" ); |
391 |
| - $.mobile.changePage( "#page1" ); |
392 |
| - $( "body" ).one( "pagechange", function(){ |
393 |
| - ok( count === 0, "getWrapper not called on pagechange back to inital page" ); |
394 |
| - start(); |
395 |
| - }); |
396 |
| - }); |
| 380 | + deepEqual( count, 0, "getWrapper only called once durring create" ); |
397 | 381 |
|
| 382 | + $.testHelper.detailedEventCascade([ |
| 383 | + function() { |
| 384 | + testPanel.panel( "open" ); |
| 385 | + }, |
| 386 | + { |
| 387 | + panelopen: { src: testPanel, event: "panelopen" + eventNs + "1" } |
| 388 | + }, |
| 389 | + function() { |
| 390 | + deepEqual( count, 0, "getWrapper not called on open" ); |
| 391 | + testPanel.panel( "close" ); |
| 392 | + }, |
| 393 | + { |
| 394 | + panelclose: { src: testPanel, event: "panelclose" + eventNs + "2" } |
| 395 | + }, |
| 396 | + function() { |
| 397 | + deepEqual( count, 0, "getWrapper not called on close" ); |
| 398 | + $.mobile.changePage( "#page2" ); |
| 399 | + }, |
| 400 | + { |
| 401 | + pagechange: { src: $( "body" ), event: "pagechange" + eventNs + "3" } |
| 402 | + }, |
| 403 | + function() { |
| 404 | + deepEqual( count, 0, "getWrapper not called on pagechange" ); |
| 405 | + $.mobile.changePage( "#page1" ); |
| 406 | + }, |
| 407 | + { |
| 408 | + pagechange: { src: $( "body" ), event: "pagechange" + eventNs + "4" } |
| 409 | + }, |
| 410 | + function() { |
| 411 | + deepEqual( count, 0, "getWrapper not called on pagechange back to initial page" ); |
| 412 | + start(); |
| 413 | + } |
| 414 | + ]); |
398 | 415 | });
|
399 |
| - asyncTest( "push should call getWrapper only once on create", function(){ |
| 416 | + |
| 417 | + asyncTest( "push panel should call getWrapper only once on create", function(){ |
400 | 418 | expect( 5 );
|
401 |
| - var testPanel = $( "#panel-test-get-wrapper-push" ); |
| 419 | + var eventNs = ".pushPanelShouldCallGetWrapperOnlyOnceOnCreate", |
| 420 | + testPanel = $( "#panel-test-get-wrapper-push" ); |
402 | 421 |
|
403 | 422 | testPanel.panel({
|
404 | 423 | "display": "push"
|
405 | 424 | });
|
406 | 425 | ok( count === 1, "getWrapper only called once durring create" );
|
407 |
| - testPanel.panel( "open" ); |
408 |
| - testPanel.one( "panelopen", function(){ |
409 |
| - ok( count === 1, "getWrapper not called on open" ); |
410 |
| - }); |
411 |
| - testPanel.panel( "close" ); |
412 |
| - testPanel.one( "panelclose", function(){ |
413 |
| - ok( count === 1, "getWrapper not called on close" ); |
414 |
| - $.mobile.changePage( "#page2" ); |
415 |
| - }); |
416 |
| - $( "body" ).one( "pagechange", function(){ |
417 |
| - ok( count === 1, "getWrapper not called on pagechange" ); |
418 |
| - $.mobile.changePage( "#page1" ); |
419 |
| - $( "body" ).one( "pagechange", function(){ |
420 |
| - ok( count === 1, "getWrapper not called on pagechange back to inital page" ); |
421 |
| - start(); |
422 |
| - }); |
423 |
| - }); |
424 | 426 |
|
| 427 | + $.testHelper.detailedEventCascade([ |
| 428 | + function() { |
| 429 | + testPanel.panel( "open" ); |
| 430 | + }, |
| 431 | + { |
| 432 | + panelopen: { src: testPanel, event: "panelopen" + eventNs + "1" } |
| 433 | + }, |
| 434 | + function() { |
| 435 | + deepEqual( count, 1, "getWrapper not called on open" ); |
| 436 | + testPanel.panel( "close" ); |
| 437 | + }, |
| 438 | + { |
| 439 | + panelclose: { src: testPanel, event: "panelclose" + eventNs + "2" } |
| 440 | + }, |
| 441 | + function() { |
| 442 | + deepEqual( count, 1, "getWrapper not called on close" ); |
| 443 | + $.mobile.changePage( "#page2" ); |
| 444 | + }, |
| 445 | + { |
| 446 | + pagechange: { src: $( "body" ), event: "pagechange" + eventNs + "3" } |
| 447 | + }, |
| 448 | + function() { |
| 449 | + deepEqual( count, 1, "getWrapper not called on pagechange" ); |
| 450 | + $.mobile.changePage( "#page1" ); |
| 451 | + }, |
| 452 | + { |
| 453 | + pagechange: { src: $( "body" ), event: "pagechange" + eventNs + "4" } |
| 454 | + }, |
| 455 | + function() { |
| 456 | + deepEqual( count, 1, "getWrapper not called on pagechange back to inital page" ); |
| 457 | + start(); |
| 458 | + } |
| 459 | + ]); |
425 | 460 | });
|
| 461 | + |
426 | 462 | asyncTest( "reveal panel should call getWrapper only once on create", function(){
|
427 | 463 | expect( 5 );
|
428 |
| - var testPanel = $( "#panel-test-get-wrapper" ); |
| 464 | + var eventNs = ".revealPanelShouldCallGetWrapperOnlyOnceOnCreate", |
| 465 | + testPanel = $( "#panel-test-get-wrapper" ); |
429 | 466 |
|
430 | 467 | testPanel.panel();
|
431 |
| - ok( count === 1, "getWrapper only called once durring create" ); |
432 |
| - testPanel.panel( "open" ); |
433 |
| - testPanel.one( "panelopen", function(){ |
434 |
| - ok( count === 1, "getWrapper not called on open" ); |
435 |
| - }); |
436 |
| - testPanel.panel( "close" ); |
437 |
| - testPanel.one( "panelclose", function(){ |
438 |
| - ok( count === 1, "getWrapper not called on close" ); |
439 |
| - $.mobile.changePage( "#page2" ); |
440 |
| - }); |
441 |
| - $( "body" ).one( "pagechange", function(){ |
442 |
| - ok( count === 1, "getWrapper not called on pagechange" ); |
443 |
| - $.mobile.changePage( "#page1" ); |
444 |
| - $( "body" ).one( "pagechange", function(){ |
445 |
| - ok( count === 1, "getWrapper not called on pagechange back to inital page" ); |
| 468 | + deepEqual( count, 1, "getWrapper only called once durring create" ); |
| 469 | + |
| 470 | + $.testHelper.detailedEventCascade([ |
| 471 | + function() { |
| 472 | + testPanel.panel( "open" ); |
| 473 | + }, |
| 474 | + { |
| 475 | + panelopen: { src: testPanel, event: "panelopen" + eventNs + "1" } |
| 476 | + }, |
| 477 | + function(){ |
| 478 | + deepEqual( count, 1, "getWrapper not called on open" ); |
| 479 | + testPanel.panel( "close" ); |
| 480 | + }, |
| 481 | + { |
| 482 | + panelclose: { src: testPanel, event: "panelclose" + eventNs + "2" } |
| 483 | + }, |
| 484 | + function() { |
| 485 | + deepEqual( count, 1, "getWrapper not called on close" ); |
| 486 | + $.mobile.changePage( "#page2" ); |
| 487 | + }, |
| 488 | + { |
| 489 | + pagechange: { src: $( "body" ), event: "pagechange" + eventNs + "3" } |
| 490 | + }, |
| 491 | + function() { |
| 492 | + deepEqual( count, 1, "getWrapper not called on pagechange" ); |
| 493 | + $.mobile.changePage( "#page1" ); |
| 494 | + }, |
| 495 | + { |
| 496 | + pagechange: { src: $( "body" ), event: "pagechange" + eventNs + "4" } |
| 497 | + }, |
| 498 | + function() { |
| 499 | + deepEqual( count, 1, "getWrapper not called on pagechange back to inital page" ); |
446 | 500 | start();
|
447 |
| - }); |
448 |
| - }); |
| 501 | + } |
| 502 | + ]); |
449 | 503 |
|
450 | 504 | });
|
451 |
| - asyncTest( "external panel should call panel once on create and on page changes", function(){ |
452 |
| - expect( 5 ); |
453 |
| - var testPanel = $( "#external-panel-getWrapper-test" ); |
454 |
| - |
455 |
| - testPanel.panel(); |
456 |
| - ok( count === 1, "getWrapper only called once durring create" ); |
457 |
| - testPanel.panel( "open" ); |
458 |
| - testPanel.one( "panelopen", function(){ |
459 |
| - ok( count === 1, "getWrapper not called on open" ); |
460 |
| - }); |
461 |
| - testPanel.panel( "close" ); |
462 |
| - testPanel.one( "panelclose", function(){ |
463 |
| - ok( count === 1, "getWrapper not called on close" ); |
464 |
| - $.mobile.changePage( "#page2" ); |
465 |
| - $( "body" ).one( "pageshow", function(){ |
466 |
| - window.setTimeout( function(){ |
467 |
| - ok( count === 2, "getWrapper called on pagechange" ); |
468 |
| - }, 0 ); |
469 |
| - |
470 |
| - $( "body" ).one( "pageshow", function(){ |
471 |
| - window.setTimeout( function(){ |
472 |
| - ok( count === 3, "getWrapper called on pagechange back to inital page" ); |
473 |
| - start(); |
| 505 | + asyncTest( "external panel should call getWrapper once on create and on page changes", |
| 506 | + function(){ |
| 507 | + expect( 5 ); |
| 508 | + var eventNs = ".externalPanelShouldCallGetWrapperOnceOnCreateAndOnPageChanges", |
| 509 | + testPanel = $( "#external-panel-getWrapper-test" ); |
| 510 | + |
| 511 | + testPanel.panel(); |
| 512 | + deepEqual( count, 1, "getWrapper only called once durring create" ); |
| 513 | + |
| 514 | + $.testHelper.detailedEventCascade([ |
| 515 | + function() { |
| 516 | + testPanel.panel( "open" ); |
| 517 | + }, |
| 518 | + { |
| 519 | + panelopen: { src: testPanel, event: "panelopen" } |
| 520 | + }, |
| 521 | + function() { |
| 522 | + deepEqual( count, 1, "getWrapper not called on open" ); |
| 523 | + testPanel.panel( "close" ); |
| 524 | + }, |
| 525 | + { |
| 526 | + panelclose: { src: testPanel, event: "panelclose" } |
| 527 | + }, |
| 528 | + function() { |
| 529 | + deepEqual( count, 1, "getWrapper not called on close" ); |
| 530 | + $.mobile.changePage( "#page2" ); |
| 531 | + }, |
| 532 | + { |
| 533 | + pageshow: { src: $( "body" ), event: "pagecontainershow" } |
| 534 | + }, |
| 535 | + function() { |
| 536 | + window.setTimeout( function() { |
| 537 | + deepEqual( count, 2, "getWrapper called on pagechange" ); |
474 | 538 | }, 0 );
|
475 |
| - }); |
476 |
| - $.mobile.changePage( "#page1" ); |
477 |
| - }); |
| 539 | + |
| 540 | + $( "body" ).one( "pagecontainershow", function() { |
| 541 | + window.setTimeout( function() { |
| 542 | + deepEqual( count, 3, |
| 543 | + "getWrapper called on pagechange back to inital page" ); |
| 544 | + start(); |
| 545 | + }, 0 ); |
| 546 | + }); |
| 547 | + $.mobile.changePage( "#page1" ); |
| 548 | + } |
| 549 | + ]); |
478 | 550 | });
|
479 |
| - }); |
480 | 551 |
|
481 | 552 | asyncTest( "external panel: test classes during A>B>A transition", function() {
|
482 | 553 | expect( 16 );
|
|
0 commit comments