Skip to content

Commit 486b5d0

Browse files
author
Gabriel Schulhof
committed
Unit tests: Add test to make sure custom select is correctly enhanced.
Only the test for the presence of the "role=button" attribute for the custom multiple select popup close button so far.
1 parent f7c0578 commit 486b5d0

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

tests/unit/select/index.html

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!DOCTYPE html>
2+
3+
<html lang="en">
4+
<head>
5+
<meta charset="UTF-8" />
6+
<title>jQuery Mobile Controlgroup 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+
<script src="../../../external/qunit.js"></script>
14+
<script>
15+
$.testHelper.asyncLoad([
16+
[
17+
"widgets/forms/select.custom"
18+
],
19+
[ "jquery.mobile.init" ],
20+
[ "select_core.js" ]
21+
]);
22+
</script>
23+
24+
<link rel="stylesheet" href="../../../css/themes/default/jquery.mobile.css"/>
25+
<link rel="stylesheet" href="../../../external/qunit.css"/>
26+
27+
<script src="../../swarminject.js"></script>
28+
</head>
29+
<body>
30+
31+
<h1 id="qunit-header">jQuery Mobile Controlgroup Test Suite</h1>
32+
<h2 id="qunit-banner"></h2>
33+
<h2 id="qunit-userAgent"></h2>
34+
<ol id="qunit-tests">
35+
</ol>
36+
37+
<div data-nstest-role="page">
38+
<div data-nstest-role="content">
39+
<div data-role="fieldcontain">
40+
<label for="role-test">Multiple:</label>
41+
<select name="role-test" id="role-test" multiple="multiple" data-nstest-native-menu="false">
42+
<option>Choose options</option>
43+
<option value="1">The 1st Option</option>
44+
<option value="2" selected="selected">The 2nd Option</option>
45+
<option value="3" selected="selected">The 3rd Option</option>
46+
<option value="4">The 4th Option</option>
47+
</select>
48+
</div>
49+
</div>
50+
</div>
51+
</body>
52+
</html>

tests/unit/select/select_core.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* mobile select unit tests
3+
*/
4+
5+
(function($){
6+
7+
module( "Custom select" );
8+
9+
test( "Custom select is enhanced correctly", function() {
10+
deepEqual( $( "#role-test-listbox a:first" ).attr( "role" ), "button", "The close button for a multiple choice select popup has the " + '"' + "role='button'" + '"' + " set" );
11+
});
12+
13+
})(jQuery);

0 commit comments

Comments
 (0)