Skip to content

Commit

Permalink
add tests for theme inheritance in select menus
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbender committed Sep 12, 2011
1 parent ee6027a commit 824bd12
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/unit/select/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<script src="../../../external/qunit.js"></script>
<script src="../../../tests/jquery.testHelper.js"></script>
<script src="../../../js"></script>
<script src="select_events.js"></script>
<script src="select_native.js"></script>
<script src="select_cached.js"></script>
<script src="select_core.js"></script>

<link rel="stylesheet" href="../../../themes/default/"/>
Expand All @@ -23,7 +26,7 @@ <h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests">
</ol>

<div id="default" data-nstest-role="page">
<div id="default" data-nstest-role="page" data-nstest-theme="c">
<div data-nstest-role="fieldcontain" id="select-choice-few-container">
<select name="select-choice-few" id="select-choice-few" data-nstest-native-menu="false">
<option value="standard">Standard: 7 day</option>
Expand Down Expand Up @@ -332,6 +335,14 @@ <h2 id="qunit-userAgent"></h2>
<select name="custom-refresh-opts-list" id="custom-refresh-opts-list" data-nstest-native-menu="false">
<option value="-1">default</option>
</select>

<select name="non-parent-themed" id="non-parent-themed" data-nstest-native-menu="false" data-nstest-theme="a">
<option value="-1">default</option>
</select>

<select name="parent-themed" id="parent-themed" data-nstest-native-menu="false">
<option value="-1">default</option>
</select>
</div>


Expand Down
13 changes: 13 additions & 0 deletions tests/unit/select/select_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,19 @@

start
], 500);
});

test( "theme defined on select is used", function(){
var select = $("select#non-parent-themed");

ok( select.siblings( "a" ).hasClass("ui-btn-up-" + select.jqmData('theme')));
});

test( "select without theme defined inherits theme from parent", function() {
var select = $("select#parent-themed");

ok( select
.siblings( "a" )
.hasClass("ui-btn-up-" + select.parents(":jqmData(role='page')").jqmData('theme')));
});
})(jQuery);

0 comments on commit 824bd12

Please sign in to comment.