From 3d14498fe137cef4c404c6546d5fd24b88affe7c Mon Sep 17 00:00:00 2001 From: John Bender Date: Mon, 15 Aug 2011 13:00:01 -0700 Subject: [PATCH] moved select caching tests out to a seperate test file to prevent issues in the core test suite --- tests/unit/select/cached-tests.html | 27 +++++++++++ tests/unit/select/select_cached.js | 70 +++++++++++++++++++++++++++++ tests/unit/select/select_core.js | 58 ------------------------ 3 files changed, 97 insertions(+), 58 deletions(-) create mode 100644 tests/unit/select/cached-tests.html create mode 100644 tests/unit/select/select_cached.js diff --git a/tests/unit/select/cached-tests.html b/tests/unit/select/cached-tests.html new file mode 100644 index 00000000..5fd212b5 --- /dev/null +++ b/tests/unit/select/cached-tests.html @@ -0,0 +1,27 @@ + + + + + + jQuery Mobile Select Events Test Suite + + + + + + + + + + + + + +

jQuery Mobile Select Event Test Suite

+

+

+
    +
+
+ + diff --git a/tests/unit/select/select_cached.js b/tests/unit/select/select_cached.js new file mode 100644 index 00000000..dbc9f219 --- /dev/null +++ b/tests/unit/select/select_cached.js @@ -0,0 +1,70 @@ +/* + * mobile select unit tests + */ + +(function($){ + var resetHash; + + resetHash = function(timeout){ + $.testHelper.openPage( location.hash.indexOf("#default") >= 0 ? "#" : "#default" ); + }; + + // https://github.com/jquery/jquery-mobile/issues/2181 + asyncTest( "dialog sized select should alter the value of its parent select", function(){ + var selectButton, value; + + $.testHelper.pageSequence([ + resetHash, + + function(){ + $.mobile.changePage( "cached.html" ); + }, + + function(){ + selectButton = $( "#cached-page-select" ).siblings( 'a' ); + selectButton.click(); + }, + + function(){ + ok( $.mobile.activePage.hasClass('ui-dialog'), "the dialog came up" ); + var option = $.mobile.activePage.find( "li a" ).not(":contains('" + selectButton.text() + "')").last(); + value = option.text(); + option.click(); + }, + + function(){ + same( value, selectButton.text(), "the selected value is propogated back to the button text" ); + start(); + } + ]); + }); + + // https://github.com/jquery/jquery-mobile/issues/2181 + asyncTest( "dialog sized select should prevent the removal of its parent page from the dom", function(){ + var selectButton, parentPageId; + + expect( 2 ); + + $.testHelper.pageSequence([ + resetHash, + + function(){ + $.mobile.changePage( "cached.html" ); + }, + + function(){ + selectButton = $.mobile.activePage.find( "#cached-page-select" ).siblings( 'a' ); + parentPageId = $.mobile.activePage.attr( 'id' ); + same( $("#" + parentPageId).length, 1, "establish the parent page exists" ); + selectButton.click(); + }, + + function(){ + same( $( "#" + parentPageId).length, 1, "make sure parent page is still there after opening the dialog" ); + $.mobile.activePage.find( "li a" ).last().click(); + }, + + start + ]); + }); +})(jQuery); \ No newline at end of file diff --git a/tests/unit/select/select_core.js b/tests/unit/select/select_core.js index ea804997..f32c345c 100644 --- a/tests/unit/select/select_core.js +++ b/tests/unit/select/select_core.js @@ -253,62 +253,4 @@ same( select.selectmenu( 'option', 'disabled' ), false, "disbaled option set" ); }); - // https://github.com/jquery/jquery-mobile/issues/2181 - asyncTest( "dialog sized select should alter the value of its parent select", function(){ - var selectButton, value; - - $.testHelper.pageSequence([ - resetHash, - - function(){ - $.mobile.changePage( "cached.html" ); - }, - - function(){ - selectButton = $( "#cached-page-select" ).siblings( 'a' ); - selectButton.click(); - }, - - function(){ - ok( $.mobile.activePage.hasClass('ui-dialog'), "the dialog came up" ); - var option = $.mobile.activePage.find( "li a" ).not(":contains('" + selectButton.text() + "')").last(); - value = option.text(); - option.click(); - }, - - function(){ - same( value, selectButton.text(), "the selected value is propogated back to the button text" ); - start(); - } - ]); - }); - - // https://github.com/jquery/jquery-mobile/issues/2181 - asyncTest( "dialog sized select should prevent the removal of its parent page from the dom", function(){ - var selectButton, parentPageId; - - expect( 2 ); - - $.testHelper.pageSequence([ - resetHash, - - function(){ - $.mobile.changePage( "cached.html" ); - }, - - function(){ - selectButton = $.mobile.activePage.find( "#cached-page-select" ).siblings( 'a' ); - parentPageId = $.mobile.activePage.attr( 'id' ); - same( $("#" + parentPageId).length, 1, "establish the parent page exists" ); - selectButton.click(); - }, - - function(){ - same( $( "#" + parentPageId).length, 1, "make sure parent page is still there after opening the dialog" ); - $.mobile.activePage.find( "li a" ).last().click(); - }, - - start - ]); - }); })(jQuery);