Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit a2834bb

Browse files
committed
removed two unnecessary tests from the navigation suite, and moved a few more over to the pageSequence helper.
1 parent dc530ea commit a2834bb

File tree

2 files changed

+26
-61
lines changed

2 files changed

+26
-61
lines changed

tests/unit/navigation/navigation_core.js

Lines changed: 26 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -15,48 +15,6 @@
1515
}
1616
});
1717

18-
asyncTest( "changepage runs once when called with an element", function(){
19-
var called = 0,
20-
newChangePage = function(a,b,c,d,e){
21-
changePageFn( a,b,c,d,e );
22-
called ++;
23-
};
24-
25-
$.testHelper.sequence([
26-
// avoid initial page load triggering changePage early
27-
function(){
28-
$.mobile.changePage = newChangePage;
29-
newChangePage($("#bar"));
30-
},
31-
32-
function(){
33-
ok(called == 1, "change page should be called once");
34-
$.mobile.changePage = changePageFn;
35-
start();
36-
}], 500);
37-
});
38-
39-
asyncTest( "changepage runs twice when triggered by a link", function(){
40-
var called = 0,
41-
newChangePage = function(a,b,c,d,e){
42-
changePageFn( a,b,c,d,e );
43-
called ++;
44-
};
45-
46-
$.testHelper.sequence([
47-
// avoid initial page load triggering changePage early
48-
function(){
49-
$.mobile.changePage = newChangePage;
50-
$('#foo a').click();
51-
},
52-
53-
function(){
54-
ok(called == 2, "change page should be called twice");
55-
$.mobile.changePage = changePageFn;
56-
start();
57-
}], 500);
58-
});
59-
6018
asyncTest( "forms with data attribute ajax set to false will not call changePage", function(){
6119
var called = false;
6220
var newChangePage = function(){
@@ -306,9 +264,11 @@
306264
});
307265

308266
asyncTest( "Page title updates properly when clicking back to previous page", function(){
309-
$.testHelper.openPage("#relative-after-embeded-page-first");
267+
$.testHelper.pageSequence([
268+
function(){
269+
$.testHelper.openPage("#relative-after-embeded-page-first");
270+
},
310271

311-
$.testHelper.sequence([
312272
function(){
313273
window.history.back();
314274
},
@@ -317,13 +277,15 @@
317277
same(document.title, "jQuery Mobile Navigation Test Suite");
318278
start();
319279
}
320-
], 500);
280+
]);
321281
});
322282

323283
asyncTest( "Page title updates properly from title tag when loading an external page", function(){
324-
$.testHelper.openPage("#ajax-title-page");
284+
$.testHelper.pageSequence([
285+
function(){
286+
$.testHelper.openPage("#ajax-title-page");
287+
},
325288

326-
$.testHelper.sequence([
327289
function(){
328290
$("#titletest1").click();
329291
},
@@ -332,12 +294,15 @@
332294
same(document.title, "Title Tag");
333295
start();
334296
}
335-
], 500);
297+
]);
336298
});
337299

338300
asyncTest( "Page title updates properly from data-title attr when loading an external page", function(){
339-
$.testHelper.openPage("#ajax-title-page");
340-
$.testHelper.sequence([
301+
$.testHelper.pageSequence([
302+
function(){
303+
$.testHelper.openPage("#ajax-title-page");
304+
},
305+
341306
function(){
342307
$("#titletest2").click();
343308
},
@@ -346,7 +311,7 @@
346311
same(document.title, "Title Attr");
347312
start();
348313
}
349-
], 500);
314+
]);
350315
});
351316

352317
asyncTest( "Page title updates properly from heading text in header when loading an external page", function(){
@@ -364,8 +329,11 @@
364329
});
365330

366331
asyncTest( "Page links to the current active page result in the same active page", function(){
367-
$.testHelper.openPage("#self-link");
368-
$.testHelper.sequence([
332+
$.testHelper.pageSequence([
333+
function(){
334+
$.testHelper.openPage("#self-link");
335+
},
336+
369337
function(){
370338
$("a[href='#self-link']").click();
371339
},
@@ -374,11 +342,11 @@
374342
same($.mobile.activePage[0], $("#self-link")[0], "self-link page is still the active page" );
375343
start();
376344
}
377-
], 500);
345+
]);
378346
});
379347

380-
asyncTest( "links on subdirectory pages with query params use an absolute path", function(){
381-
$.testHelper.sequence([
348+
asyncTest( "links on subdirectory pages with query params append the params and load the page", function(){
349+
$.testHelper.pageSequence([
382350
function(){
383351
$.testHelper.openPage("#data-url-tests/non-data-url.html");
384352
},
@@ -389,10 +357,10 @@
389357

390358
function(){
391359
same(location.hash, "#data-url-tests/non-data-url.html?foo=bar");
392-
ok($(".ui-page-active").jqmData("url").indexOf("?foo=bar") > -1, "the query params are in the hash");
360+
ok($(".ui-page-active").jqmData("url").indexOf("?foo=bar") > -1, "the query params are in the data url");
393361
start();
394362
}
395-
], 1000);
363+
]);
396364
});
397365

398366
asyncTest( "identical query param link doesn't add additional set of query params", function(){

tests/unit/navigation/navigation_paths.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
var testPageLoad = function(testPageAnchorSelector, expectedTextValue){
66
expect( 2 );
77

8-
// remove cached pages to make sure the page request hits the test
9-
$(".ui-page > .test-value").parents(".ui-page").remove();
10-
118
$.testHelper.pageSequence([
129
// open our test page
1310
function(){

0 commit comments

Comments
 (0)