Permalink
Browse files

test navbar button click functionality

  • Loading branch information...
1 parent c804280 commit a9d9ca3dac835e5fb7b10ebd269231f4f6af1abd @johnbender johnbender committed Nov 15, 2011
Showing with 51 additions and 0 deletions.
  1. +33 −0 tests/unit/navbar/index.html
  2. +18 −0 tests/unit/navbar/navbar_core.js
@@ -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>
@@ -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);

0 comments on commit a9d9ca3

Please sign in to comment.