forked from jquery-archive/jquery-mobile
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test navbar button click functionality
- Loading branch information
1 parent
c804280
commit a9d9ca3
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |