This repository was archived by the owner on Oct 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fixed Toolbar: removing popup removes ui-page-header-fixed class #7252
Closed
cgack
wants to merge
1
commit into
jquery-archive:master
from
cgack:6987-destroyed-popup-removes-page-header-fixed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <title>jQuery Mobile Toolbar Test Suite</title> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
|
||
| <script src="../../../external/requirejs/require.js"></script> | ||
| <script src="../../../js/requirejs.config.js"></script> | ||
| <script src="../../../js/jquery.tag.inserter.js"></script> | ||
| <script src="../../jquery.setNameSpace.js"></script> | ||
| <script src="../../../tests/jquery.testHelper.js"></script> | ||
| <script src="../../../external/qunit/qunit.js"></script> | ||
| <script> | ||
| $.testHelper.asyncLoad([ | ||
| [ | ||
| "navigation/method", | ||
| "buttonMarkup", | ||
| "widgets/toolbar", | ||
| ], | ||
| [ "init"], | ||
| [ "./toolbar_core.js" ] | ||
| ]); | ||
| </script> | ||
|
|
||
| <link rel="stylesheet" href="../../../css/themes/default/jquery.mobile.css"/> | ||
| <link rel="stylesheet" href="../../../external/qunit/qunit.css"/> | ||
| <link rel="stylesheet" href="../../jqm-tests.css"/> | ||
|
|
||
| <script src="../../swarminject.js"></script> | ||
| </head> | ||
| <body> | ||
|
|
||
| <div id="qunit"></div> | ||
| <div data-nstest-role="page" id="default"> | ||
| <div data-nstest-role="header" id="testHeaderClasses"> | ||
| <h1>Header</h1> | ||
| </div> | ||
| <div data-nstest-role="footer" id="testFooterClasses"> | ||
| <h1>Footer</h1> | ||
| </div> | ||
| <div id="testInit"> | ||
| <h1>Header</h1> | ||
| </div> | ||
| </div> | ||
| <div data-nstest-role="page" id="destroyPage"> | ||
| <div id="testDestroy" > | ||
| <h1>title</h1> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div data-nstest-role="header" class="ui-screen-hidden" id="testExternalHeader"> | ||
| <h1>External Header</h1> | ||
| </div> | ||
|
|
||
| <div data-nstest-role="footer" class="ui-screen-hidden" id="testExternalFooter"> | ||
| <h1>External Footer</h1> | ||
| </div> | ||
|
|
||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| /* | ||
| * mobile Fixed Toolbar unit tests | ||
| */ | ||
| (function($){ | ||
| module( "toolbar" ); | ||
|
|
||
| test( "header classes and roles assigned correctly", function() { | ||
| $( ":mobile-pagecontainer" ).pagecontainer( "change", "#default" ); | ||
| var toolbar = $( "#testHeaderClasses" ); | ||
|
|
||
| ok( toolbar.hasClass( "ui-header" ), "toolbar gets ui-header after init" ); | ||
| ok( toolbar.find( "h1" ).hasClass( "ui-title" ), "toolbar title assigned correctly"); | ||
| ok( toolbar.attr( "role" ) === "banner", "header gets banner role assigned" ); | ||
| ok( toolbar.find( "h1" ).attr( "role" ) === "heading", "heading role properly assigned"); | ||
| }); | ||
|
|
||
|
|
||
| test( "footer classes and roles assigned correctly", function() { | ||
| $( ":mobile-pagecontainer" ).pagecontainer( "change", "#default" ); | ||
| var toolbar = $( "#testFooterClasses" ); | ||
|
|
||
| ok( toolbar.hasClass( "ui-footer" ), "toolbar gets ui-footer after init" ); | ||
| ok( toolbar.find( "h1" ).hasClass( "ui-title" ), "toolbar title assigned correctly"); | ||
| ok( toolbar.attr( "role" ) === "contentinfo", "footer gets contentinfo role assigned" ); | ||
| ok( toolbar.find( "h1" ).attr( "role" ) === "heading", "heading role properly assigned"); | ||
| }); | ||
|
|
||
|
|
||
| asyncTest( "manual init works properly", function() { | ||
| $( ":mobile-pagecontainer" ).pagecontainer( "change", "#default" ); | ||
| expect( 3 ); | ||
|
|
||
| var toolbar = $( "#testInit" ).toolbar({ | ||
| create: function( event, ui ) { | ||
| ok( true, "create event fired" ); | ||
| start(); | ||
| } | ||
| }); | ||
|
|
||
| ok( toolbar.hasClass( "ui-footer" ), "manual init gets footer class" ); | ||
| ok( toolbar.find( "h1" ).hasClass( "ui-title" ), "ui-title assigned"); | ||
| }); | ||
|
|
||
| asyncTest( "external headers are created properly", function() { | ||
| $( ":mobile-pagecontainer" ).pagecontainer( "change", "#default" ); | ||
| expect( 3 ); | ||
|
|
||
| var toolbar = $( "#testExternalHeader" ).toolbar({ | ||
| create: function( event, ui ) { | ||
| ok( true, "external toolbar create event" ); | ||
| start(); | ||
| } | ||
| }); | ||
|
|
||
| ok( toolbar.hasClass( "ui-header" ), "external toolbar gets ui-header class" ); | ||
| ok( toolbar.find( "h1" ).hasClass( "ui-title" ), "ui-title assigned properly" ); | ||
| }); | ||
|
|
||
| asyncTest( "external footers are created properly", function() { | ||
| $( ":mobile-pagecontainer" ).pagecontainer( "change", "#default" ); | ||
| expect( 3 ); | ||
|
|
||
| var toolbar = $( "#testExternalFooter" ).toolbar({ | ||
| create: function( event, ui ) { | ||
| ok( true, "external toolbar create event" ); | ||
| start(); | ||
| } | ||
| }); | ||
|
|
||
| ok( toolbar.hasClass( "ui-footer" ), "external toolbar gets ui-footer class" ); | ||
| ok( toolbar.find( "h1" ).hasClass( "ui-title" ), "ui-title assigned properly" ); | ||
| }); | ||
|
|
||
| test( "destroy preserves original structure", function() { | ||
| $( ":mobile-pagecontainer" ).pagecontainer( "change", "#destroyPage" ); | ||
|
|
||
| var unEnhanced = $("#testDestroy").clone(), | ||
| destroyed = $("#testDestroy").toolbar().toolbar("destroy"), | ||
| unEnhancedHeader = $( "<div data-" + ( $.mobile.ns || "" ) + "role='header'>" + | ||
| "<h1>title</h1>" + | ||
| "</div>" ), | ||
| headerClone = unEnhancedHeader.clone(); | ||
| $( "#destroyPage" ).append( headerClone ); | ||
| headerClone.toolbar().toolbar("destroy"); | ||
|
|
||
| ok( $.testHelper.domEqual( destroyed, unEnhanced ), "unEnhanced footer equals destroyed" ); | ||
| ok( $.testHelper.domEqual( headerClone, unEnhancedHeader), "headers match after destroy" ); | ||
| }); | ||
|
|
||
| })(jQuery); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we still need to remove the padding if there are no other active fixed headers / footers it just needs to be done insdie of the if ( hasFixed )