2 * mobile select unit tests
8 resetHash = function(timeout){
9 $.testHelper.openPage( location.hash.indexOf("#default") >= 0 ? "#" : "#default" );
12 // https://github.com/jquery/jquery-mobile/issues/2181
13 asyncTest( "dialog sized select should alter the value of its parent select", function(){
14 var selectButton, value;
16 $.testHelper.pageSequence([
20 $.mobile.changePage( "cached.html" );
24 selectButton = $( "#cached-page-select" ).siblings( 'a' );
29 ok( $.mobile.activePage.hasClass('ui-dialog'), "the dialog came up" );
30 var option = $.mobile.activePage.find( "li a" ).not(":contains('" + selectButton.text() + "')").last();
31 value = option.text();
36 same( value, selectButton.text(), "the selected value is propogated back to the button text" );
42 // https://github.com/jquery/jquery-mobile/issues/2181
43 asyncTest( "dialog sized select should prevent the removal of its parent page from the dom", function(){
44 var selectButton, parentPageId;
48 $.testHelper.pageSequence([
52 $.mobile.changePage( "cached.html" );
56 selectButton = $.mobile.activePage.find( "#cached-page-select" ).siblings( 'a' );
57 parentPageId = $.mobile.activePage.attr( 'id' );
58 same( $("#" + parentPageId).length, 1, "establish the parent page exists" );
63 same( $( "#" + parentPageId).length, 1, "make sure parent page is still there after opening the dialog" );
64 $.mobile.activePage.find( "li a" ).last().click();
71 asyncTest( "dialog sized select shouldn't rebind its parent page remove handler when closing, if the parent page domCache option is true", function(){
74 $.testHelper.pageSequence([
78 $.mobile.changePage( "cached-dom-cache-true.html" );
82 $.mobile.activePage.find( "#domcache-page-select" ).siblings( 'a' ).click();
86 ok( $.mobile.activePage.hasClass('ui-dialog'), "the dialog came up" );
87 $.mobile.activePage.find( "li a" ).last().click();
91 ok( $.mobile.activePage.is( "#dialog-select-parent-domcache-test" ), "the dialog closed" );
92 $.mobile.changePage( $( "#default" ) );
96 same( $("#dialog-select-parent-domcache-test").length, 1, "make sure the select parent page is still cached in the dom after changing page" );
102 asyncTest( "menupage is removed when the parent page is removed", function(){
103 var dialogCount = $(":jqmData(role='dialog')").length;
105 $.testHelper.pageSequence([
110 $.mobile.changePage( "uncached-dom-cached-false.html" );
114 same( $(":jqmData(role='dialog')").length, dialogCount + 1 );
115 window.history.back();
119 same( $(":jqmData(role='dialog')").length, dialogCount );