mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-22 23:24:43 +00:00
test navbar button click functionality
This commit is contained in:
parent
c80428062a
commit
a9d9ca3dac
2 changed files with 51 additions and 0 deletions
33
tests/unit/navbar/index.html
Normal file
33
tests/unit/navbar/index.html
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>jQuery Mobile Navigation Test Suite</title>
|
||||
|
||||
<script src="../../../js/jquery.js"></script>
|
||||
<script src="../jquery.setNameSpace.js"></script>
|
||||
<script src="../../../js/"></script>
|
||||
<script src="../../../tests/jquery.testHelper.js"></script>
|
||||
<link rel="stylesheet" href="../../../css/themes/default/"/>
|
||||
<link rel="stylesheet" href="../../../external/qunit.css"/>
|
||||
<script src="../../../external/qunit.js"></script>
|
||||
<script src="navbar_core.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header">jQuery Mobile Navigation Test Suite</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests">
|
||||
</ol>
|
||||
|
||||
<div data-nstest-role="page" id="disabled-btn-click">
|
||||
<div data-nstest-role="navbar">
|
||||
<ul>
|
||||
<li><a href="#" class="ui-disabled">One</a></li>
|
||||
<li><a href="#">Two</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
18
tests/unit/navbar/navbar_core.js
Normal file
18
tests/unit/navbar/navbar_core.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* mobile navbar unit tests
|
||||
*/
|
||||
(function($){
|
||||
test( "navbar button gets active button class when clicked", function() {
|
||||
var link = $("#disabled-btn-click a:not(.ui-disabled)").first();
|
||||
|
||||
link.click();
|
||||
ok( link.hasClass($.mobile.activeBtnClass), "link has active button class" );
|
||||
});
|
||||
|
||||
test( "disabled navbar button doesn't add active button class when clicked", function() {
|
||||
var link = $("#disabled-btn-click a.ui-disabled").first();
|
||||
|
||||
link.click();
|
||||
ok( !link.hasClass($.mobile.activeBtnClass), "link doesn't have active button class" );
|
||||
});
|
||||
})(jQuery);
|
||||
Loading…
Reference in a new issue