Permalink
Browse files

Pagecontainer: Hide loader and release transition lock at page load fail

Fixes gh-3143
Closes gh-7915
  • Loading branch information...
gabrielschulhof committed Jan 14, 2015
1 parent 1d6b533 commit 866fa98ec7f6d63b4ba26539ae0e22327afda228
@@ -725,6 +725,10 @@ define( [
triggerData.textStatus = textStatus;
triggerData.errorThrown = errorThrown;
// Clean up internal pending operations like the loader and the transition lock
this._hideLoading();
this._releaseTransitionLock();
// Let listeners know the page load failed.
var plfEvent = this._triggerWithDeprecated( "loadfailed", triggerData );
@@ -0,0 +1,40 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery Mobile Pagecontainer Event Sequence 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([
[ "init" ],
[
"page_load_failure_core.js"
]
]);
</script>
<script src="../../swarminject.js"></script>
</head>
<body id="the-body">
<div id="qunit"></div>
<div data-nstest-role="page" id="start-page">
<div data-role="header"><h1>Start page</h1></div>
<div class="ui-content">
<a href="page-does-not-exist.html" id="go-to-nonexistent-page">Go to non-existent page</a>
<a href="other-page.html" id="go-to-other-page">Go to other page</a>
</div>
</div>
</body>
</html>
@@ -0,0 +1,34 @@
module( "Pagecontainer" );
asyncTest( "hides loader and clears transition lock when page load fails", function() {
expect( 3 );
$( document ).on( "pagecontainerloadfailed", function( event ) {
// Prevent error message shown by default
event.preventDefault();
setTimeout( function() {
deepEqual( $.mobile.loading().is( ":visible" ), false, "Loader is hidden" );
$.testHelper.pageSequence([
function() {
$( "#go-to-other-page" ).click();
},
function() {
deepEqual( $.mobile.pageContainer.pagecontainer( "getActivePage" )
.attr( "id" ), "other-page",
"The other page is the active page" );
$.mobile.back();
},
function() {
deepEqual( $.mobile.pageContainer.pagecontainer( "getActivePage" )
.attr( "id" ), "start-page",
"Returned to start page" );
start();
}
]);
}, 500 );
});
$( "#go-to-nonexistent-page" ).click();
});

0 comments on commit 866fa98

Please sign in to comment.