forked from jquery-archive/jquery-mobile
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Panel: Invalidate _openedPage upon pageshow before recomputing wrapper
Fixes jquery-archivegh-7711
- Loading branch information
Showing
3 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
48 changes: 48 additions & 0 deletions
48
tests/integration/panel/external-panel-wrapper-update-tests.html
This file contains 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,48 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>jQuery Mobile Panel Test Suite</title> | ||
|
||
<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> | ||
|
||
<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="../../../external/qunit/qunit.js"></script> | ||
<script> | ||
$.testHelper.asyncLoad([ | ||
[ "widgets/page" ], | ||
[ "widgets/panel" ], | ||
[ "init" ], | ||
[ "external_panel_wrapper_update_core.js" ] | ||
]); | ||
</script> | ||
|
||
<script src="../../swarminject.js"></script> | ||
</head> | ||
<body> | ||
<div id="qunit"></div> | ||
|
||
<div data-nstest-role="panel" id="wrapper-test-panel" data-nstest-display="reveal"> | ||
<p>The panel</p> | ||
<a href="#other-page" id="go-to-other-page" data-nstest-transition="none">Go to other page</a> | ||
</div> | ||
|
||
<div data-nstest-role="page"> | ||
<div class="ui-content"> | ||
<p>Start page</p> | ||
</div> | ||
</div> | ||
|
||
<div data-nstest-role="page" id="other-page"> | ||
<div class="ui-content"> | ||
<p>Other page</p> | ||
</div> | ||
</div> | ||
</body> |
46 changes: 46 additions & 0 deletions
46
tests/integration/panel/external_panel_wrapper_update_core.js
This file contains 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,46 @@ | ||
var panel = $( "#wrapper-test-panel" ).panel(); | ||
|
||
asyncTest( "External panel updates wrapper correctly", function() { | ||
var otherPageChildren, | ||
otherPage = $( "#other-page" ), | ||
otherPageLink = $( "#go-to-other-page" ); | ||
|
||
expect( 5 ); | ||
|
||
$.testHelper.detailedEventCascade([ | ||
function() { | ||
panel.panel( "open" ); | ||
}, | ||
{ | ||
panelopen: { src: panel, event: "panelopen.externalPanelUpdatesWrapperCorrectly1" } | ||
}, | ||
function( result ) { | ||
deepEqual( result.panelopen.timedOut, false, "Panel did open" ); | ||
otherPageLink.click(); | ||
}, | ||
{ | ||
panelclose: { src: panel, event: "panelclose.externalPanelUpdatesWrapperCorrectly2" }, | ||
pagecontainerchange: { | ||
src: $( window ), | ||
event: "pagecontainerchange.externalPanelUpdatesWrapperCorrectly2" | ||
} | ||
}, | ||
function( result ) { | ||
otherPageChildren = otherPage.children(); | ||
deepEqual( result.panelclose.timedOut, false, "Panel did close upon link click" ); | ||
deepEqual( result.pagecontainerchange.timedOut, false, | ||
"pagecontainerchange event received" ); | ||
deepEqual( otherPageChildren.length, 1, "Other page has exactly one child" ); | ||
deepEqual( otherPageChildren.hasClass( "ui-panel-wrapper" ), true, | ||
"Other page child has class 'ui-panel-wrapper'" ); | ||
$.mobile.back(); | ||
}, | ||
{ | ||
pagecontainerchange: { | ||
src: $( window ), | ||
event: "pagecontainerchange.externalPanelUpdatesWrapperCorrectly2" | ||
} | ||
}, | ||
start | ||
]); | ||
}); |