fixed up unit test so that it's now properly testing the ajax dom caching page option

This commit is contained in:
scottjehl 2011-07-26 09:52:36 -04:00 committed by John Bender
parent a8c3859d84
commit 2b1baeb078
2 changed files with 14 additions and 31 deletions

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div data-nstest-role="page" id="external-test"></div>
</body>
</html>

View file

@ -25,25 +25,21 @@
asyncTest( "External page is removed from the DOM after pagehide", function(){
$( "#external-test" )
.live( "pageshow", function(){
setTimeout(function(){
window.history.back();
}, 500):
window.history.back();
})
.live( "pagehide", function(){
setTimeout(function(){
same( $( "#external-test" ).length, 0 );
start();
}, 500):
}, 500);
})
$.mobile.changePage( "external.html" );
});
asyncTest( "forms with data attribute ajax set to false will not call changePage", function(){
var called = false;
@ -86,28 +82,6 @@
start();
}], 300);
});
//testing the data-prefetch attr
var prefetched = false;
$('#prefetch').live('pagecreate',function(event){
prefetched = true;
ok( true, 'Page fetched properly' );
window.history.back();
start();
});
asyncTest( "data-prefetch attribute on an anchor will preload the referenced page when its parent page is shown", function(){
setTimeout(function(){
if( !prefetched ){
ok( false, 'Page wasn\'t fetched properly' );
window.history.back();
start();
}
}, 1000);
$.mobile.changePage( "#prefetch" );
});
asyncTest( "anchors with no href attribute will do nothing when clicked", function(){