Permalink
Browse files

Checkboxradio: Depend on vmouse and test custom, widget-only-build

(cherry picked from commit dc3fa7d)

Closes gh-7295
Fixes gh-7294
Re gh-5987
  • Loading branch information...
gabrielschulhof committed Apr 3, 2014
1 parent 5f2dd7e commit 26b1d1636aeda7c731d85b6e86df8ebb20d230b8
@@ -10,6 +10,7 @@
//>>css.theme: ../css/themes/default/jquery.mobile.theme.css
define( [ "jquery",
"../../vmouse",
"../../navigation/path",
"../../jquery.mobile.core",
"../../jquery.mobile.widget",
@@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery Mobile Collapsible Test Suite</title>
<script src="../../../external/requirejs/require.js"></script>
<script src="../../../js/requirejs.config.js"></script>
<script src="../../../js/jquery.tag.inserter.js"></script>
<script src="../../jquery.setNameSpace.js"></script>
<script src="../../../tests/jquery.testHelper.js"></script>
<link rel="stylesheet" href="../../../css/themes/default/jquery.mobile.css"/>
<link rel="stylesheet" href="../../../external/qunit/qunit.css"/>
<link rel="stylesheet" href="../../jqm-tests.css"/>
<script src="../../../external/qunit/qunit.js"></script>
<script>
$.testHelper.asyncLoad([
[
"widgets/forms/checkboxradio"
],
[
"checkboxradio_core.js"
]
]);
</script>
<script src="../../swarminject.js"></script>
</head>
<body>
<div id="qunit"></div>
<label>The Checkbox<input type="checkbox" id="the-checkbox"></label>
</body>
</html>
@@ -0,0 +1,14 @@
test( "Checkboxradio widget works correctly", function() {
var checkbox = $( "#the-checkbox" ).checkboxradio(),
initiallyChecked = checkbox.prop( "checked" );
deepEqual( checkbox.parent().hasClass( "ui-checkbox" ), true,
"Wrapper has class ui-checkbox" );
deepEqual( checkbox.siblings( "label" ).hasClass( "ui-btn" ), true,
"Input has a sibling <label> with class ui-btn" );
checkbox.siblings( "label" ).click();
deepEqual( checkbox.prop( "checked" ), !initiallyChecked,
"Clicking the label toggles the checkbox" );
});

0 comments on commit 26b1d16

Please sign in to comment.