mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
moved select caching tests out to a seperate test file to prevent issues in the core test suite
This commit is contained in:
parent
907cf655b3
commit
3d14498fe1
3 changed files with 97 additions and 58 deletions
27
tests/unit/select/cached-tests.html
Normal file
27
tests/unit/select/cached-tests.html
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>jQuery Mobile Select Events Test Suite</title>
|
||||
|
||||
<script src="../../../js/jquery.js"></script>
|
||||
<script src="../jquery.setNameSpace.js"></script>
|
||||
<script src="../../../external/qunit.js"></script>
|
||||
<script src="../../../tests/jquery.testHelper.js"></script>
|
||||
<script src="../../../js"></script>
|
||||
<script src="select_cached.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="../../../themes/default/"/>
|
||||
<link rel="stylesheet" href="../../../external/qunit.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="qunit-header">jQuery Mobile Select Event Test Suite</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests">
|
||||
</ol>
|
||||
<div id="default" data-nstest-role="page"></div>
|
||||
</body>
|
||||
</html>
|
||||
70
tests/unit/select/select_cached.js
Normal file
70
tests/unit/select/select_cached.js
Normal file
|
|
@ -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);
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue