Merge remote-tracking branch 'upstream/master'

This commit is contained in:
gseguin 2011-08-17 13:29:07 -07:00
commit 3737d170a0
14 changed files with 375 additions and 223 deletions

View file

@ -60,6 +60,7 @@ JSFILES = js/jquery.ui.widget.js \
js/jquery.mobile.forms.button.js \
js/jquery.mobile.forms.slider.js \
js/jquery.mobile.forms.textinput.js \
js/jquery.mobile.forms.select.custom.js \
js/jquery.mobile.forms.select.js \
js/jquery.mobile.buttonMarkup.js \
js/jquery.mobile.controlGroup.js \
@ -126,7 +127,7 @@ notify:
@@echo "The files have been built and are in " $$(pwd)/${OUTPUT}
# Pull the latest commits. This is used for the nightly build but can be used to save some keystrokes
pull:
pull:
@@git pull --quiet
# Zip the 4 files and the theme images into one convenient package
@ -161,7 +162,7 @@ nightly: pull zip
# Change the empty paths to the location of this nightly file
@@find ${VER} -type f -name '*.html' -exec sed -i 's|href="themes/default/"|href="${NIGHTLY_WEBPATH}/${DIR}.min.css"|g' {} \;
@@find ${VER} -type f -name '*.html' -exec sed -i 's|src="js/jquery.js"|src="http://code.jquery.com/jquery-${JQUERY}.min.js"|' {} \;
@@find ${VER} -type f -name '*.html' -exec sed -i 's|src="js/"|src="${NIGHTLY_WEBPATH}/${DIR}.min.js"|g' {} \;
@@find ${VER} -type f -name '*.html' -exec sed -i 's|src="js/"|src="${NIGHTLY_WEBPATH}/${DIR}.min.js"|g' {} \;
# Move the demos into the output folder
@@mv ${VER} ${OUTPUT}/demos

View file

@ -30,7 +30,7 @@
js/jquery.mobile.core.js,
js/jquery.mobile.navigation.js,
js/jquery.mobile.transition.js,
js/jquery.mobile.degradeInputs.js,
js/jquery.mobile.degradeInputs.js,
js/jquery.mobile.dialog.js,
js/jquery.mobile.page.sections.js,
js/jquery.mobile.collapsible.js,
@ -44,6 +44,7 @@
js/jquery.mobile.forms.button.js,
js/jquery.mobile.forms.slider.js,
js/jquery.mobile.forms.textinput.js,
js/jquery.mobile.forms.select.custom.js,
js/jquery.mobile.forms.select.js,
js/jquery.mobile.buttonMarkup.js,
js/jquery.mobile.controlGroup.js,

View file

@ -14,7 +14,7 @@
<body>
<div data-role="page" class="type-interior">
<div data-role="page">
<div data-role="header" data-theme="a">
<h1>Purchase?</h1>

View file

@ -248,9 +248,11 @@
// rebind the page remove that was unbound in the open function
// to allow for the parent page removal from actions other than the use
// of a dialog sized custom select
self.thisPage.bind( "pagehide.remove", function() {
$(this).remove();
});
if( !self.thisPage.data("page").options.domCache ){
self.thisPage.bind( "pagehide.remove", function() {
$(this).remove();
});
}
// doesn't solve the possible issue with calling change page
// where the objects don't define data urls which prevents dialog key
@ -459,9 +461,11 @@
});
};
$( "select:jqmData(native-menu='false')" ).live( "selectmenubeforecreate", function(){
$( "select" ).live( "selectmenubeforecreate", function(){
var selectmenuWidget = $( this ).data( "selectmenu" );
extendSelect( selectmenuWidget );
if( !selectmenuWidget.options.nativeMenu ){
extendSelect( selectmenuWidget );
}
});
})( jQuery );

View file

@ -3,20 +3,38 @@
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../../external/qunit.css"></link>
<script src="../../js/jquery.js"></script>
<script src="../../external/qunit.js"></script>
<script src="runner.js"></script>
<style type="text/css">
html, body {
width:100%;
height:100%;
margin:0px;
padding:0px;
}
#testFrame {
float: left;
border: 0px;
height: 100%;
width: 60%;
}
#results {
float: left;
width: 30%;
}
</style>
</head>
<body>
<div style="float: left; width: 500px;">
<div id="results">
<h1 id="qunit-header"><a href="#">jQuery Mobile Test Suite</a></h1>
<h2 id="qunit-banner"></h2>
<ol id="qunit-tests">
</ol>
</div>
<!-- under normal circumstances inline styles would be a poor choice, but in this case
I think an entire link and stylesheet is a waste -->
<iframe data-src="../../tests/unit/{{testdir}}" name="testFrame" id="testFrame" width="800px" height="100%" style="float: left; border: 0px; height: 100%;" scrolling="no">
<iframe data-src="../../tests/unit/{{testdir}}" name="testFrame" id="testFrame" scrolling="no">
</iframe>
<script src="../../js/jquery.js"></script>
<script src="../../external/qunit.js"></script>
<script src="runner.js"></script>
</body>
</html>

View file

@ -13,6 +13,8 @@
closedir($handle);
}
sort($directories);
echo json_encode( array('directories' => $directories ));
$test_pages = array_merge($directories, glob("**/*-tests.html"));
sort($test_pages);
echo json_encode( array('testPages' => $test_pages));
?>

View file

@ -8,7 +8,7 @@
<a href="../app-base/base-page-1.html" class="bp1">Base Page 1</a>
<a href="../../#internal-page-1" class="ip1">Internal Page 1</a>
<a href="../../#internal-page-2" class="ip2">Internal Page 2</a>
<img src="images/content-page-2.png">
<img src="images/content-page-2.png">
</div>
</body>
</html>

View file

@ -21,7 +21,7 @@
$.testHelper.pageSequence([
function(){
// Navigate from default internal page to another internal page.
$.testHelper.openPage("#internal-page-2");
$.testHelper.openPage("#internal-page-2");
},
function(){
@ -93,8 +93,8 @@
// Verify that we are on the expected page.
same(location.hash, "#" + contentDir + "content-page-2.html", "call changePage() with a relative path should resolve relative to current page");
// Try calling changePage() with an id
$.mobile.changePage("#internal-page-2");
// test that an internal page works
$("a.ip2").click();
},
function(){

View file

@ -1,58 +1,82 @@
(function(){
var test = function(data){
var $frameElem = $("#testFrame"),
template = $frameElem.attr("data-src"),
updateFrame = function(dir){
return $frameElem.attr("src", template.replace("{{testdir}}", dir));
};
$(function() {
var Runner = function( ) {
var self = this;
$.each(data.directories, function(i, dir){
asyncTest( dir, function(){
var testTimeout = 3 * 60 * 1000, checkInterval = 2000;
$.extend( self, {
frame: window.frames[ "testFrame" ],
testTimeout: 3 * 60 * 1000,
$frameElem: $( "#testFrame" ),
assertionResultPrefix: "assertion result for test:",
onTimeout: QUnit.start,
onFrameLoad: function() {
// establish a timeout for a given suite in case of async tests hanging
var testTimer = setTimeout( function(){
// prevent any schedule checks for completion
clearTimeouts();
start();
}, testTimeout ),
self.testTimer = setTimeout( self.onTimeout, self.testTimeout );
checkTimer = setInterval( check, checkInterval ),
// when the QUnit object reports done in the iframe
// run the onFrameDone method
self.frame.QUnit.done = self.onFrameDone;
self.frame.QUnit.testDone = self.onTestDone;
},
clearTimeouts = function(){
// prevent the next interval of the check function and the test timeout
clearTimeout( checkTimer );
clearTimeout( testTimer );
};
onTestDone: function( name, bad, assertCount ) {
QUnit.ok( !bad, name );
self.recordAssertions( assertCount - 1, name );
},
// check the iframe for success or failure and respond accordingly
function check(){
// check for the frames jquery object each time
var framejQuery = window.frames["testFrame"].jQuery;
onFrameDone: function( failed, passed, total, runtime ){
// make sure we don't time out the tests
clearTimeout( self.testTimer );
// if the iframe hasn't loaded (ie loaded jQuery) check back again shortly
if( !framejQuery ) return;
// TODO decipher actual cause of multiple test results firing twice
// clear the done call to prevent early completion of other test cases
self.frame.QUnit.done = $.noop;
self.frame.QUnit.testDone = $.noop;
// grab the result of the iframe test suite
// TODO strip extra white space
var result = framejQuery( "#qunit-banner" ).attr( "class" );
// hide the extra assertions made to propogate the count
// to the suite level test
self.hideAssertionResults();
// if we have a result check it, otherwise check back shortly
if( result ){
ok( result === "qunit-pass" );
clearTimeouts();
start();
}
};
// continue on to the next suite
QUnit.start();
},
expect( 1 );
recordAssertions: function( count, parentTest ) {
for( var i = 0; i < count; i++ ) {
ok( true, self.assertionResultPrefix + parentTest );
}
},
// set the test suite page on the iframe
updateFrame( dir );
});
hideAssertionResults: function() {
$( "li:not([id]):contains('" + self.assertionResultPrefix + "')" ).hide();
},
exec: function( data ) {
var template = self.$frameElem.attr( "data-src" );
$.each( data.testPages, function(i, dir) {
QUnit.asyncTest( dir, function() {
self.dir = dir;
self.$frameElem.one( "load", self.onFrameLoad );
self.$frameElem.attr( "src", template.replace("{{testdir}}", dir) );
});
});
// having defined all suite level tests let QUnit run
QUnit.start();
}
});
};
// prevent qunit from starting the test suite until all tests are defined
QUnit.begin = function( ) {
this.config.autostart = false;
};
// get the test directories
$.get("ls.php", test);
})();
$.get( "ls.php", (new Runner()).exec );
});

View file

@ -0,0 +1,65 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div id="dialog-select-parent-domcache-test" data-nstest-role="page" data-nstest-dom-cache="true">
<div data-nstest-role="fieldcontain" id="domcache-page-select-container">
<label for="domcache-page-select" class="select">Your state:</label>
<select name="domcache-page-select" id="domcache-page-select" data-nstest-native-menu="false">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
</div>
</div>
</body>
</html>

View file

@ -1,65 +1,27 @@
<!DOCTYPE HTML>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div id="dialog-select-parent-cache-test" data-nstest-role="page">
<div data-nstest-role="fieldcontain" id="cached-page-select-container">
<label for="cached-page-select" class="select">Your state:</label>
<select name="cached-page-select" id="cached-page-select" data-nstest-native-menu="false">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
</div>
</div>
</body>
<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>

View file

@ -0,0 +1,65 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div id="dialog-select-parent-cache-test" data-nstest-role="page">
<div data-nstest-role="fieldcontain" id="cached-page-select-container">
<label for="cached-page-select" class="select">Your state:</label>
<select name="cached-page-select" id="cached-page-select" data-nstest-native-menu="false">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,101 @@
/*
* 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
]);
});
asyncTest( "dialog sized select shouldn't rebind its parent page remove handler when closing, if the parent page domCache option is true", function(){
expect( 3 );
$.testHelper.pageSequence([
resetHash,
function(){
$.mobile.changePage( "cached-dom-cache-true.html" );
},
function(){
$.mobile.activePage.find( "#domcache-page-select" ).siblings( 'a' ).click();
},
function(){
ok( $.mobile.activePage.hasClass('ui-dialog'), "the dialog came up" );
$.mobile.activePage.find( "li a" ).last().click();
},
function(){
ok( $.mobile.activePage.is( "#dialog-select-parent-domcache-test" ), "the dialog closed" );
$.mobile.changePage( $( "#default" ) );
},
function(){
same( $("#dialog-select-parent-domcache-test").length, 1, "make sure the select parent page is still cached in the dom after changing page" );
start();
}
]);
});
})(jQuery);

View file

@ -71,41 +71,6 @@
]);
});
asyncTest( "a large select menu should come up in a dialog many times", function(){
var menu, select;
// if the second test doesn't run the dialog didn't come back up
expect( 2 );
$.testHelper.pageSequence([
resetHash,
function(){
select = $("#select-choice-many-container a");
// bring up the dialog
select.trigger("click");
},
function(){
ok( $.mobile.activePage.is( ".ui-dialog "), "current page is a dialog" );
closeDialog();
},
function(){
//bring up the dialog again
select.trigger("click");
},
function(){
ok( $.mobile.activePage.is( ".ui-dialog "), "current page is a dialog" );
closeDialog();
},
start
]);
});
asyncTest( "custom select menu always renders screen from the left", function(){
var select;
@ -204,65 +169,6 @@
], 500);
});
// 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-tests.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-tests.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
]);
});
asyncTest( "using custom refocuses the button after close", function() {
var select, button, triggered = false;
@ -290,11 +196,13 @@
ok(triggered, "focus is triggered");
start();
}
], 1000);
], 5000);
});
asyncTest( "selected items are highlighted", function(){
$.testHelper.sequence([
resetHash,
function(){
// bring up the smaller choice menu
ok($("#select-choice-few-container a").length > 0, "there is in fact a button in the page");
@ -344,4 +252,5 @@
same( button.attr('aria-disabled'), "false", "select is disabled" );
same( select.selectmenu( 'option', 'disabled' ), false, "disbaled option set" );
});
})(jQuery);