removed two unnecessary tests from the navigation suite, and moved a few more over to the pageSequence helper.

This commit is contained in:
John Bender 2011-05-21 23:36:06 -07:00
parent dc530ea751
commit a2834bb367
2 changed files with 26 additions and 61 deletions

View file

@ -15,48 +15,6 @@
}
});
asyncTest( "changepage runs once when called with an element", function(){
var called = 0,
newChangePage = function(a,b,c,d,e){
changePageFn( a,b,c,d,e );
called ++;
};
$.testHelper.sequence([
// avoid initial page load triggering changePage early
function(){
$.mobile.changePage = newChangePage;
newChangePage($("#bar"));
},
function(){
ok(called == 1, "change page should be called once");
$.mobile.changePage = changePageFn;
start();
}], 500);
});
asyncTest( "changepage runs twice when triggered by a link", function(){
var called = 0,
newChangePage = function(a,b,c,d,e){
changePageFn( a,b,c,d,e );
called ++;
};
$.testHelper.sequence([
// avoid initial page load triggering changePage early
function(){
$.mobile.changePage = newChangePage;
$('#foo a').click();
},
function(){
ok(called == 2, "change page should be called twice");
$.mobile.changePage = changePageFn;
start();
}], 500);
});
asyncTest( "forms with data attribute ajax set to false will not call changePage", function(){
var called = false;
var newChangePage = function(){
@ -306,9 +264,11 @@
});
asyncTest( "Page title updates properly when clicking back to previous page", function(){
$.testHelper.openPage("#relative-after-embeded-page-first");
$.testHelper.pageSequence([
function(){
$.testHelper.openPage("#relative-after-embeded-page-first");
},
$.testHelper.sequence([
function(){
window.history.back();
},
@ -317,13 +277,15 @@
same(document.title, "jQuery Mobile Navigation Test Suite");
start();
}
], 500);
]);
});
asyncTest( "Page title updates properly from title tag when loading an external page", function(){
$.testHelper.openPage("#ajax-title-page");
$.testHelper.pageSequence([
function(){
$.testHelper.openPage("#ajax-title-page");
},
$.testHelper.sequence([
function(){
$("#titletest1").click();
},
@ -332,12 +294,15 @@
same(document.title, "Title Tag");
start();
}
], 500);
]);
});
asyncTest( "Page title updates properly from data-title attr when loading an external page", function(){
$.testHelper.openPage("#ajax-title-page");
$.testHelper.sequence([
$.testHelper.pageSequence([
function(){
$.testHelper.openPage("#ajax-title-page");
},
function(){
$("#titletest2").click();
},
@ -346,7 +311,7 @@
same(document.title, "Title Attr");
start();
}
], 500);
]);
});
asyncTest( "Page title updates properly from heading text in header when loading an external page", function(){
@ -364,8 +329,11 @@
});
asyncTest( "Page links to the current active page result in the same active page", function(){
$.testHelper.openPage("#self-link");
$.testHelper.sequence([
$.testHelper.pageSequence([
function(){
$.testHelper.openPage("#self-link");
},
function(){
$("a[href='#self-link']").click();
},
@ -374,11 +342,11 @@
same($.mobile.activePage[0], $("#self-link")[0], "self-link page is still the active page" );
start();
}
], 500);
]);
});
asyncTest( "links on subdirectory pages with query params use an absolute path", function(){
$.testHelper.sequence([
asyncTest( "links on subdirectory pages with query params append the params and load the page", function(){
$.testHelper.pageSequence([
function(){
$.testHelper.openPage("#data-url-tests/non-data-url.html");
},
@ -389,10 +357,10 @@
function(){
same(location.hash, "#data-url-tests/non-data-url.html?foo=bar");
ok($(".ui-page-active").jqmData("url").indexOf("?foo=bar") > -1, "the query params are in the hash");
ok($(".ui-page-active").jqmData("url").indexOf("?foo=bar") > -1, "the query params are in the data url");
start();
}
], 1000);
]);
});
asyncTest( "identical query param link doesn't add additional set of query params", function(){

View file

@ -5,9 +5,6 @@
var testPageLoad = function(testPageAnchorSelector, expectedTextValue){
expect( 2 );
// remove cached pages to make sure the page request hits the test
$(".ui-page > .test-value").parents(".ui-page").remove();
$.testHelper.pageSequence([
// open our test page
function(){