Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

prevent adding to a non jquery object in fixedToolBar Fixes #3675

  • Loading branch information...
commit b9e8de5fa4fd2f9a1c59f8d9cef50f886c2a8a9d 1 parent 48e7fd6
@johnbender johnbender authored
View
5 js/jquery.mobile.fixedToolbar.js
@@ -159,16 +159,17 @@ define( [ "jquery", "./jquery.mobile.widget", "./jquery.mobile.core", "./jquery.
nextFooter = thisFooter.length && ui.nextPage && $( ".ui-footer-fixed:jqmData(id='" + thisFooter.jqmData( "id" ) + "')", ui.nextPage ),
nextHeader = thisHeader.length && ui.nextPage && $( ".ui-header-fixed:jqmData(id='" + thisHeader.jqmData( "id" ) + "')", ui.nextPage );
+ nextFooter = nextFooter || $();
+
if( nextFooter.length || nextHeader.length ){
nextFooter.add( nextHeader ).appendTo( $.mobile.pageContainer );
ui.nextPage.one( "pageshow", function(){
nextFooter.add( nextHeader ).appendTo( this );
- } );
+ });
}
}
-
});
},
View
72 tests/unit/fixedToolbar/fixedToolbar.js
@@ -40,10 +40,10 @@
ok( $('#classes-test-f').hasClass('ui-footer-fullscreen'), 'A footer with data-position=fixed and data-fullscreen should have ui-footer-fullscreen class');
//parent
- ok( $('#classes-test-b').closest( ".ui-page" ).hasClass( "ui-page-header-fixed" ), "Parent page of a fixed header has class ui-page-header-fixed" )
- ok( $('#classes-test-e').closest( ".ui-page" ).hasClass( "ui-page-footer-fixed" ), "Parent page of a fixed footer has class ui-page-header-fixed" )
- ok( $('#classes-test-c').closest( ".ui-page" ).hasClass( "ui-page-header-fullscreen" ), "Parent page of a fullscreen header has class ui-page-header-fullscreen" )
- ok( $('#classes-test-f').closest( ".ui-page" ).hasClass( "ui-page-footer-fullscreen" ), "Parent page of a fullscreen footer has class ui-page-header-fullscreen" )
+ ok( $('#classes-test-b').closest( ".ui-page" ).hasClass( "ui-page-header-fixed" ), "Parent page of a fixed header has class ui-page-header-fixed" );
+ ok( $('#classes-test-e').closest( ".ui-page" ).hasClass( "ui-page-footer-fixed" ), "Parent page of a fixed footer has class ui-page-header-fixed" );
+ ok( $('#classes-test-c').closest( ".ui-page" ).hasClass( "ui-page-header-fullscreen" ), "Parent page of a fullscreen header has class ui-page-header-fullscreen" );
+ ok( $('#classes-test-f').closest( ".ui-page" ).hasClass( "ui-page-footer-fullscreen" ), "Parent page of a fullscreen footer has class ui-page-header-fullscreen" );
});
@@ -256,4 +256,68 @@
start
]);
});
+
+ asyncTest( "The persistent headers should work without a footer", function() {
+
+ expect( 3 );
+
+ $( "#persist-test-c, #persist-test-d" ).page();
+
+ var nextpageheader = $( "#persist-test-d .ui-header-fixed" );
+
+ $.testHelper.pageSequence([
+ function(){
+ ok( nextpageheader.length, "next page has fixed header and fixed footer" );
+ $.mobile.changePage( "#persist-test-c" );
+ },
+
+ function(){
+ $( "#persist-test-d" )
+ .one( "pagebeforeshow", function(){
+ same( nextpageheader.parent()[0], $.mobile.pageContainer[0], "fixed header is now a child of page container" );
+ });
+
+ $.mobile.changePage( "#persist-test-d" );
+ },
+
+ function() {
+ same( nextpageheader.parent()[0], $.mobile.activePage[0], "fixed header is now a child of page again" );
+ $.mobile.changePage( "#default" );
+ },
+
+ start
+ ]);
+ });
+
+ asyncTest( "The persistent footers should work without a header", function() {
+
+ expect( 3 );
+
+ $( "#persist-test-e, #persist-test-f" ).page();
+
+ var nextpagefooter = $( "#persist-test-f .ui-footer-fixed" );
+
+ $.testHelper.pageSequence([
+ function(){
+ ok( nextpagefooter.length, "next page has fixed footer and fixed footer" );
+ $.mobile.changePage( "#persist-test-e" );
+ },
+
+ function(){
+ $( "#persist-test-f" )
+ .one( "pagebeforeshow", function(){
+ same( nextpagefooter.parent()[0], $.mobile.pageContainer[0], "fixed footer is now a child of page container" );
+ });
+
+ $.mobile.changePage( "#persist-test-f" );
+ },
+
+ function() {
+ same( nextpagefooter.parent()[0], $.mobile.activePage[0], "fixed footer is now a child of page again" );
+ $.mobile.changePage( "#default" );
+ },
+
+ start
+ ]);
+ });
})(jQuery);
View
22 tests/unit/fixedToolbar/index.html
@@ -12,13 +12,9 @@
<script src="../../../external/qunit.js"></script>
<script>
$.testHelper.asyncLoad([
- [
- "jquery.mobile.fixedToolbar"
- ],
+ [ "jquery.mobile.fixedToolbar" ],
[ "jquery.mobile.init" ],
- [
- "./fixedToolbar.js"
- ]
+ [ "./fixedToolbar.js" ]
]);
</script>
@@ -64,6 +60,20 @@ <h2 id="qunit-userAgent"></h2>
<div data-nstest-role="footer" data-nstest-position="fixed" data-nstest-id="b"></div>
</div>
+<div data-nstest-role="page" id="persist-test-c">
+ <div data-nstest-role="header" data-nstest-position="fixed" data-nstest-id="c"></div>
+</div>
+
+<div data-nstest-role="page" id="persist-test-d">
+ <div data-nstest-role="header" data-nstest-position="fixed" data-nstest-id="c"></div>
+</div>
+<div data-nstest-role="page" id="persist-test-e">
+ <div data-nstest-role="footer" data-nstest-position="fixed" data-nstest-id="d"></div>
+</div>
+
+<div data-nstest-role="page" id="persist-test-f">
+ <div data-nstest-role="footer" data-nstest-position="fixed" data-nstest-id="d"></div>
+</div>
</body>
</html>
Please sign in to comment.
Something went wrong with that request. Please try again.