This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pagecontainer: Hide loader and release transition lock at page load fail
- Loading branch information
Gabriel Schulhof
committed
Apr 3, 2015
1 parent
1d6b533
commit 866fa98
Showing
3 changed files
with
78 additions
and
0 deletions.
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
40 changes: 40 additions & 0 deletions
40
tests/integration/pagecontainer/page-load-failure-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,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> |
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,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(); | ||
}); |