Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit dc3fa7d

Browse files
author
Gabriel Schulhof
committed
Checkboxradio: Depend on vmouse and test custom, widget-only-build
Closes gh-7295 Fixes gh-7294 Re gh-5987
1 parent 459bb59 commit dc3fa7d

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

js/widgets/forms/checkboxradio.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//>>css.theme: ../css/themes/default/jquery.mobile.theme.css
1111

1212
define( [ "jquery",
13+
"../../vmouse",
1314
"../../navigation/path",
1415
"../../core",
1516
"../../widget",
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>jQuery Mobile Collapsible Test Suite</title>
7+
8+
<script src="../../../external/requirejs/require.js"></script>
9+
<script src="../../../js/requirejs.config.js"></script>
10+
<script src="../../../js/jquery.tag.inserter.js"></script>
11+
<script src="../../jquery.setNameSpace.js"></script>
12+
<script src="../../../tests/jquery.testHelper.js"></script>
13+
14+
<link rel="stylesheet" href="../../../css/themes/default/jquery.mobile.css"/>
15+
<link rel="stylesheet" href="../../../external/qunit/qunit.css"/>
16+
<link rel="stylesheet" href="../../jqm-tests.css"/>
17+
<script src="../../../external/qunit/qunit.js"></script>
18+
<script>
19+
$.testHelper.asyncLoad([
20+
[
21+
"widgets/forms/checkboxradio"
22+
],
23+
[
24+
"checkboxradio_core.js"
25+
]
26+
]);
27+
</script>
28+
29+
<script src="../../swarminject.js"></script>
30+
</head>
31+
<body>
32+
<div id="qunit"></div>
33+
34+
<label>The Checkbox<input type="checkbox" id="the-checkbox"></label>
35+
</body>
36+
</html>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
test( "Checkboxradio widget works correctly", function() {
2+
var checkbox = $( "#the-checkbox" ).checkboxradio(),
3+
initiallyChecked = checkbox.prop( "checked" );
4+
5+
deepEqual( checkbox.parent().hasClass( "ui-checkbox" ), true,
6+
"Wrapper has class ui-checkbox" );
7+
deepEqual( checkbox.siblings( "label" ).hasClass( "ui-btn" ), true,
8+
"Input has a sibling <label> with class ui-btn" );
9+
10+
checkbox.siblings( "label" ).click();
11+
12+
deepEqual( checkbox.prop( "checked" ), !initiallyChecked,
13+
"Clicking the label toggles the checkbox" );
14+
});

0 commit comments

Comments
 (0)