Skip to content

Commit e39a320

Browse files
committed
Added unit tests for issue jquery-archive#1405
1 parent 9f3836e commit e39a320

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

tests/unit/navigation/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,17 @@ <h1>Dialog</h1>
247247
</div>
248248
</div>
249249

250+
<div id="active-state-page1" data-nstest-role="page">
251+
<div data-nstest-role="content">
252+
<a href="#active-state-page2" data-nstest-role="button">page2</a>
253+
</div>
254+
</div>
250255

256+
<div id="active-state-page2" data-nstest-role="page">
257+
<div data-nstest-role="content">
258+
<a href="#active-state-page1" data-nstest-role="button">href button</a>
259+
<a href="#active-state-page1" data-nstest-rel="back" data-nstest-role="button">back button</a>
260+
</div>
261+
</div>
251262
</body>
252263
</html>

tests/unit/navigation/navigation_core.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,4 +608,55 @@
608608
}
609609
]);
610610
});
611+
612+
asyncTest( "handling of active button state when navigating", 1, function(){
613+
614+
$.testHelper.pageSequence([
615+
// open our test page
616+
function(){
617+
$.testHelper.openPage("#active-state-page1");
618+
},
619+
620+
function(){
621+
$("#active-state-page1 a").eq(0).click();
622+
},
623+
624+
function(){
625+
$("#active-state-page2 a").eq(0).click();
626+
},
627+
628+
function(){
629+
ok(!$("#active-state-page1 a").hasClass( $.mobile.activeBtnClass ), "No button should not have class " + $.mobile.activeBtnClass );
630+
start();
631+
}
632+
]);
633+
});
634+
635+
asyncTest( "handling of button active state when navigating by clicking back button", 1, function(){
636+
637+
$.testHelper.pageSequence([
638+
// open our test page
639+
function(){
640+
$.testHelper.openPage("#active-state-page1");
641+
},
642+
643+
function(){
644+
$("#active-state-page1 a").eq(0).click();
645+
},
646+
647+
function(){
648+
$("#active-state-page2 a").eq(1).click();
649+
},
650+
651+
function(){
652+
$("#active-state-page1 a").eq(0).click();
653+
},
654+
655+
function(){
656+
ok(!$("#active-state-page2 a").hasClass( $.mobile.activeBtnClass ), "No button should not have class " + $.mobile.activeBtnClass );
657+
start();
658+
}
659+
]);
660+
});
661+
611662
})(jQuery);

0 commit comments

Comments
 (0)