This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Checkboxradio: Depend on vmouse and test custom, widget-only-build
- Loading branch information
Gabriel Schulhof
committed
Apr 24, 2014
1 parent
5f2dd7e
commit 26b1d16
Showing
3 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
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,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> |
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,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" ); | ||
}); |