tests for enhance and exclusion through keepNative

This commit is contained in:
John Bender 2011-10-10 14:20:43 -07:00
parent b958e84e2c
commit 623433f75b
2 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,14 @@
/*
* mobile button unit tests
*/
(function($){
$.mobile.page.prototype.options.keepNative = "button.should-be-native";
test( "button elements in the keepNative set shouldn't be enhanced", function() {
same( $("button.should-be-native").siblings("div.ui-slider").length, 0 );
});
test( "button elements should be enhanced", function() {
ok( $("#enhanced").hasClass( "ui-btn-hidden" ) );
});
})( jQuery );

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery Mobile Button 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="../../../themes/default/"/>
<link rel="stylesheet" href="../../../external/qunit.css"/>
<script src="../../../external/qunit.js"></script>
<script src="button_core.js"></script>
<script src="../swarminject.js"></script>
</head>
<body>
<h1 id="qunit-header">jQuery Mobile Button Test Suite</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests">
</ol>
<div data-nstest-role="page" data-nstest-theme="a">
<div data-nstest-role="content" data-nstest-theme="p">
<button class="should-be-native">foo</button>
<button id="enhanced">bar</button>
</div>
</div>
</body>
</html>