9
9
same ( $ ( 'input#not-to-be-degraded' ) . attr ( "type" ) , "range" ) ;
10
10
} ) ;
11
11
12
- test ( 'should degrade input type to a different type, as specified in page options' , function ( ) {
12
+ asyncTest ( 'should degrade input type to a different type, as specified in page options' , function ( ) {
13
13
var degradeInputs = $ . mobile . page . prototype . options . degradeInputs ;
14
14
15
15
expect ( degradeInputs . length ) ;
16
16
17
- // Initialize dialog page
18
- $ . mobile . changePage ( $ ( '#dialog' ) ) ;
19
- $ . mobile . changePage ( $ ( '#page' ) ) ;
17
+ // NOTE the initial page is already enhanced (or expected to be) so we load the dialog to enhance it
18
+ // and _expect_ that the default page will remain "unreaped". This will break if that assumption changes
19
+ $ . testHelper . pageSequence ( [
20
+ function ( ) {
21
+ $ . mobile . changePage ( "#dialog" ) ;
22
+ } ,
20
23
21
- $ . each ( degradeInputs , function ( oldType , newType ) {
22
- if ( newType === false ) {
23
- newType = oldType ;
24
- }
24
+ function ( ) {
25
+ $ . each ( degradeInputs , function ( oldType , newType ) {
26
+ if ( newType === false ) {
27
+ newType = oldType ;
28
+ }
29
+
30
+ $ ( '#page-test-container' ) . html ( '<input type="' + oldType + '" />' ) . trigger ( "create" ) ;
25
31
26
- $ ( '#page-test-container' ) . html ( '<input type="' + oldType + '" />' ) . trigger ( "create" ) ;
32
+ same ( $ ( '#page-test-container input ' ) . attr ( " type" ) , newType , "type attr on page is: " + newType ) ;
27
33
28
- same ( $ ( '#page -test-container input ' ) . attr ( " type" ) , newType ) ;
34
+ $ ( '#dialog -test-container' ) . html ( '<input type="' + oldType + '" />' ) . trigger ( "create" ) ;
29
35
30
- $ ( '#dialog-test-container' ) . html ( '<input type="' + oldType + '" />' ) . trigger ( "create" ) ;
36
+ same ( $ ( '#dialog-test-container input' ) . attr ( "type" ) , newType , "type attr on dialog is: " + newType ) ;
37
+ } ) ;
31
38
32
- same ( $ ( '#dialog-test-container input' ) . attr ( "type" ) , newType ) ;
33
- } ) ;
39
+ start ( ) ;
40
+ }
41
+ ] ) ;
34
42
} ) ;
35
43
} ) ( jQuery ) ;
0 commit comments