Merge remote-tracking branch 'upstream/master'

This commit is contained in:
gseguin 2011-08-10 23:08:56 -07:00
commit 97b7c20e78
5 changed files with 55 additions and 30 deletions

View file

@ -123,9 +123,9 @@
// so if it's 1, use 0 from now on
$.mobile.defaultHomeScroll = ( !$.support.scrollTop || $(window).scrollTop() === 1 ) ? 0 : 1;
// dom-ready inits
if ( $.mobile.autoInitializePage ) {
$( $.mobile.initializePage );
//dom-ready inits
if( $.mobile.autoInitializePage ){
$.mobile.initializePage();
}
// window load event

View file

@ -11,13 +11,13 @@
<script>
$(function(){
$( "a" ).bind("tap",function( e ){
$( "a" ).bind("tap click",function( e ){
$("#log")
.prepend("<li>"+ e.type +" event; target: "+ e.target.nodeName +"</li>")
.listview("refresh");
return false;
})
.bind("click", false);
.bind("tap click", false);
});
</script>

View file

@ -10,19 +10,19 @@
<script>
$(function(){
$(".ui-grid-d a").bind("tap", function(e){
$(".ui-grid-d a").bind("tap click", function(e){
$(this).hide();
$("#log")
.prepend("<li>"+ e.type +" event; target: "+ e.target.nodeName +"; message: grid '"+$(this).text()+"' hidden</li>")
.listview("refresh");
return false;
}).bind("click", false);
$("#showbtn").bind("tap", function(e){
}).bind("tap click", false);
$("#showbtn").bind("tap click", function(e){
$(".ui-grid-d a").show();
$("#log")
.prepend("<li>"+ e.type +" event; target: "+ e.target.nodeName +"; message: show all buttons</li>")
.listview("refresh");
}).bind("click", false);
}).bind("tap click", false);
});
</script>
</head>

View file

@ -1,24 +1,38 @@
/*
* mobile dialog unit tests
*/
(function($){
module('jquery.mobile.dialog.js');
(function($) {
module( "jquery.mobile.dialog.js" );
asyncTest( "dialog hash is added when the dialog is opened and removed when closed", function(){
expect( 2 );
asyncTest( "dialog hash is added when the dialog is opened and removed when closed", function() {
expect( 6 );
//bring up the dialog
$("a[href='#foo-dialog']").click();
$.testHelper.pageSequence([
function() {
//bring up the dialog
$( "#foo-dialog-link" ).click();
},
setTimeout(function(){
ok(/&ui-state=dialog/.test(location.hash), "ui-state=dialog =~ location.hash");
// close the dialog
$(".ui-dialog").dialog("close");
}, 500);
function() {
var fooDialog = $( "#foo-dialog" );
setTimeout(function(){
ok(!/&ui-state=dialog/.test(location.hash), "ui-state=dialog !~ location.hash");
start();
}, 1000);
// make sure the dialog came up
ok( /&ui-state=dialog/.test(location.hash), "ui-state=dialog =~ location.hash", "dialog open" );
// Assert dialog theme inheritance (issue 1375):
ok( fooDialog.hasClass( "ui-body-b" ), "Expected explicit theme ui-body-b" );
ok( fooDialog.find( ":jqmData(role=header)" ).hasClass( "ui-bar-a" ), "Expected header to inherit from $.mobile.page.prototype.options.headerTheme" );
ok( fooDialog.find( ":jqmData(role=content)" ).hasClass( "ui-body-d" ), "Expect content to inherit from $.mobile.page.prototype.options.contentTheme" );
ok( fooDialog.find( ":jqmData(role=footer)" ).hasClass( "ui-bar-a" ), "Expected footer to inherit from $.mobile.page.prototype.options.footerTheme" );
// close the dialog
$( ".ui-dialog" ).dialog( "close" );
},
function() {
ok( !/&ui-state=dialog/.test(location.hash), "ui-state=dialog !~ location.hash" );
start();
}
]);
});
})(jQuery);
})( jQuery );

View file

@ -6,6 +6,12 @@
<title>jQuery Mobile Dialog Test Suite</title>
<script src="../../../js/jquery.js"></script>
<script>
$(document).bind('mobileinit',function(){
// Expect content to inherit this theme when not explicitly set
$.mobile.page.prototype.options.contentTheme = "d";
});
</script>
<script src="../jquery.setNameSpace.js"></script>
<script src="../../../js/"></script>
<script src="../../../tests/jquery.testHelper.js"></script>
@ -25,15 +31,20 @@
<ol id="qunit-tests">
</ol>
<div id="bar" data-nstest-role="page">
<a href="#foo-dialog" data-nstest-role="button" data-nstest-inline="true" data-nstest-rel="dialog"></a>
<div id="bar" data-nstest-role="page" data-nstest-theme="a">
<a href="#foo-dialog" id="foo-dialog-link" data-nstest-role="button" data-nstest-inline="true" data-nstest-rel="dialog"></a>
</div>
<div id="foo-dialog" data-nstest-role="dialog">
<div data-nstest-role="header" data-nstest-theme="d" data-nstest-position="inline">
<div id="foo-dialog" data-nstest-role="dialog" data-nstest-theme="b">
<div data-nstest-role="header" data-nstest-position="inline">
<h1>Dialog</h1>
</div>
<a href="#" id="internal-link">foo</a>
<div data-nstest-role="content" >
<a href="#" id="internal-link">foo</a>
</div>
<div data-nstest-role="footer">
footer
</div>
</div>
</body>