@@ -2,101 +2,101 @@ var panel = $( "#wrapper-test-panel" ).panel(),
22 stretchTestPanel = $ ( "#panel-stretch-test" ) . panel ( ) ;
33
44asyncTest ( "External panel updates wrapper correctly" , function ( ) {
5- var otherPageChildren ,
6- thisPage = $ ( "#start-page" ) ,
7- otherPage = $ ( "#other-page" ) ,
8- otherPageLink = $ ( "#go-to-other-page" ) ;
5+ var otherPageChildren ,
6+ thisPage = $ ( "#start-page" ) ,
7+ otherPage = $ ( "#other-page" ) ,
8+ otherPageLink = $ ( "#go-to-other-page" ) ;
99
10- expect ( 7 ) ;
10+ expect ( 7 ) ;
1111
12- $ . testHelper . detailedEventCascade ( [
13- function ( ) {
14- panel . panel ( "open" ) ;
15- } ,
16- {
17- panelopen : { src : panel , event : "panelopen.externalPanelUpdatesWrapperCorrectly1" }
18- } ,
19- function ( result ) {
20- deepEqual ( result . panelopen . timedOut , false , "Panel did open" ) ;
21- deepEqual ( thisPage . data ( $ . mobile . ns + "panel" ) , "open" ,
22- "Data at key 'panel' on opening page present" ) ;
23- otherPageLink . click ( ) ;
24- } ,
25- {
26- panelclose : { src : panel , event : "panelclose.externalPanelUpdatesWrapperCorrectly2" } ,
27- pagecontainerchange : {
28- src : $ ( window ) ,
29- event : "pagecontainerchange.externalPanelUpdatesWrapperCorrectly2"
30- }
31- } ,
32- function ( result ) {
33- otherPageChildren = otherPage . children ( ) ;
34- deepEqual ( result . panelclose . timedOut , false , "Panel did close upon link click" ) ;
35- deepEqual ( result . pagecontainerchange . timedOut , false ,
36- "pagecontainerchange event received" ) ;
37- deepEqual ( otherPageChildren . length , 1 , "Other page has exactly one child" ) ;
38- deepEqual ( otherPageChildren . hasClass ( "ui-panel-wrapper" ) , true ,
39- "Other page child has class 'ui-panel-wrapper'" ) ;
40- deepEqual ( thisPage . data ( $ . mobile . ns + "panel" ) , undefined ,
41- "Data at key 'panel' on opening page absent" ) ;
42- $ . mobile . back ( ) ;
43- } ,
44- {
45- pagecontainerchange : {
46- src : $ ( window ) ,
47- event : "pagecontainerchange.externalPanelUpdatesWrapperCorrectly2"
48- }
49- } ,
50- start
51- ] ) ;
52- } ) ;
12+ $ . testHelper . detailedEventCascade ( [
13+ function ( ) {
14+ panel . panel ( "open" ) ;
15+ } ,
16+ {
17+ panelopen : { src : panel , event : "panelopen.externalPanelUpdatesWrapperCorrectly1" }
18+ } ,
19+ function ( result ) {
20+ deepEqual ( result . panelopen . timedOut , false , "Panel did open" ) ;
21+ deepEqual ( thisPage . data ( $ . mobile . ns + "panel" ) , "open" ,
22+ "Data at key 'panel' on opening page present" ) ;
23+ otherPageLink . click ( ) ;
24+ } ,
25+ {
26+ panelclose : { src : panel , event : "panelclose.externalPanelUpdatesWrapperCorrectly2" } ,
27+ pagecontainerchange : {
28+ src : $ ( window ) ,
29+ event : "pagecontainerchange.externalPanelUpdatesWrapperCorrectly2"
30+ }
31+ } ,
32+ function ( result ) {
33+ otherPageChildren = otherPage . children ( ) ;
34+ deepEqual ( result . panelclose . timedOut , false , "Panel did close upon link click" ) ;
35+ deepEqual ( result . pagecontainerchange . timedOut , false ,
36+ "pagecontainerchange event received" ) ;
37+ deepEqual ( otherPageChildren . length , 1 , "Other page has exactly one child" ) ;
38+ deepEqual ( otherPageChildren . hasClass ( "ui-panel-wrapper" ) , true ,
39+ "Other page child has class 'ui-panel-wrapper'" ) ;
40+ deepEqual ( thisPage . data ( $ . mobile . ns + "panel" ) , undefined ,
41+ "Data at key 'panel' on opening page absent" ) ;
42+ $ . mobile . back ( ) ;
43+ } ,
44+ {
45+ pagecontainerchange : {
46+ src : $ ( window ) ,
47+ event : "pagecontainerchange.externalPanelUpdatesWrapperCorrectly2"
48+ }
49+ } ,
50+ start
51+ ] ) ;
52+ } ) ;
5353
5454asyncTest ( "External panel stretches to acommodate page height" , function ( assert ) {
55- expect ( 4 ) ;
55+ expect ( 4 ) ;
5656
57- var eventNs = ".externalPanelStretches" ;
57+ var eventNs = ".externalPanelStretches" ;
5858
59- $ . testHelper . detailedEventCascade ( [
60- function ( ) {
61- $ ( "body" ) . pagecontainer ( "change" , "#panel-stretch-page" ) ;
62- } ,
63- {
64- pagecontainerchange : { src : $ ( window ) , event : "pagecontainerchange" + eventNs + "1" }
65- } ,
66- function ( result ) {
67- assert . deepEqual ( result . pagecontainerchange . timedOut , false ,
68- "Successfully changed to page '#panel-stretch-page'" ) ;
59+ $ . testHelper . detailedEventCascade ( [
60+ function ( ) {
61+ $ ( "body" ) . pagecontainer ( "change" , "#panel-stretch-page" ) ;
62+ } ,
63+ {
64+ pagecontainerchange : { src : $ ( window ) , event : "pagecontainerchange" + eventNs + "1" }
65+ } ,
66+ function ( result ) {
67+ assert . deepEqual ( result . pagecontainerchange . timedOut , false ,
68+ "Successfully changed to page '#panel-stretch-page'" ) ;
6969
70- // Make the page scroll
71- $ ( "#panel-stretch-page .ui-content" ) . height ( $ . mobile . getScreenHeight ( ) * 3 ) ;
70+ // Make the page scroll
71+ $ ( "#panel-stretch-page .ui-content" ) . height ( $ . mobile . getScreenHeight ( ) * 3 ) ;
7272
73- stretchTestPanel . panel ( "open" ) ;
74- } ,
75- {
76- panelopen : { src : stretchTestPanel , event : "panelopen" + eventNs + "2" }
77- } ,
78- function ( result ) {
73+ stretchTestPanel . panel ( "open" ) ;
74+ } ,
75+ {
76+ panelopen : { src : stretchTestPanel , event : "panelopen" + eventNs + "2" }
77+ } ,
78+ function ( result ) {
7979
80- // Making assertions about the document height has to happen immediately after the
81- // operation that modifies the document height takes place, because the act of
82- // recording the assertion itself may modify the document height, because QUnit will
83- // insert new DOM elements to visually record the assertion, and the addition of such
84- // DOM elements may affect the document height.
85- assert . deepEqual ( stretchTestPanel . outerHeight ( true ) , $ ( document ) . height ( ) ,
86- "Panel is as tall as the document" ) ;
87- assert . deepEqual ( result . panelopen . timedOut , false , "Panel opened successfully" ) ;
88- stretchTestPanel . panel ( "close" ) ;
89- } ,
90- {
91- panelclose : { src : stretchTestPanel , event : "panelclose" + eventNs + "3" }
92- } ,
93- function ( result ) {
94- assert . deepEqual ( result . panelclose . timedOut , false , "Panel closedsuccessfully" ) ;
95- $ . mobile . back ( ) ;
96- } ,
97- {
98- pagecontainerchange : { src : $ ( window ) , event : "pagecontainerchange" + eventNs + "4" }
99- } ,
100- start
101- ] ) ;
80+ // Making assertions about the document height has to happen immediately after the
81+ // operation that modifies the document height takes place, because the act of
82+ // recording the assertion itself may modify the document height, because QUnit will
83+ // insert new DOM elements to visually record the assertion, and the addition of such
84+ // DOM elements may affect the document height.
85+ assert . deepEqual ( stretchTestPanel . outerHeight ( true ) , $ ( document ) . height ( ) ,
86+ "Panel is as tall as the document" ) ;
87+ assert . deepEqual ( result . panelopen . timedOut , false , "Panel opened successfully" ) ;
88+ stretchTestPanel . panel ( "close" ) ;
89+ } ,
90+ {
91+ panelclose : { src : stretchTestPanel , event : "panelclose" + eventNs + "3" }
92+ } ,
93+ function ( result ) {
94+ assert . deepEqual ( result . panelclose . timedOut , false , "Panel closedsuccessfully" ) ;
95+ $ . mobile . back ( ) ;
96+ } ,
97+ {
98+ pagecontainerchange : { src : $ ( window ) , event : "pagecontainerchange" + eventNs + "4" }
99+ } ,
100+ start
101+ ] ) ;
102102} ) ;
0 commit comments