Added unit tests for issue #1405

This commit is contained in:
gseguin 2011-08-17 18:15:57 -07:00
parent 9f3836e7b1
commit e39a320214
2 changed files with 62 additions and 0 deletions

View file

@ -247,6 +247,17 @@
</div>
</div>
<div id="active-state-page1" data-nstest-role="page">
<div data-nstest-role="content">
<a href="#active-state-page2" data-nstest-role="button">page2</a>
</div>
</div>
<div id="active-state-page2" data-nstest-role="page">
<div data-nstest-role="content">
<a href="#active-state-page1" data-nstest-role="button">href button</a>
<a href="#active-state-page1" data-nstest-rel="back" data-nstest-role="button">back button</a>
</div>
</div>
</body>
</html>

View file

@ -608,4 +608,55 @@
}
]);
});
asyncTest( "handling of active button state when navigating", 1, function(){
$.testHelper.pageSequence([
// open our test page
function(){
$.testHelper.openPage("#active-state-page1");
},
function(){
$("#active-state-page1 a").eq(0).click();
},
function(){
$("#active-state-page2 a").eq(0).click();
},
function(){
ok(!$("#active-state-page1 a").hasClass( $.mobile.activeBtnClass ), "No button should not have class " + $.mobile.activeBtnClass );
start();
}
]);
});
asyncTest( "handling of button active state when navigating by clicking back button", 1, function(){
$.testHelper.pageSequence([
// open our test page
function(){
$.testHelper.openPage("#active-state-page1");
},
function(){
$("#active-state-page1 a").eq(0).click();
},
function(){
$("#active-state-page2 a").eq(1).click();
},
function(){
$("#active-state-page1 a").eq(0).click();
},
function(){
ok(!$("#active-state-page2 a").hasClass( $.mobile.activeBtnClass ), "No button should not have class " + $.mobile.activeBtnClass );
start();
}
]);
});
})(jQuery);