Permalink
Browse files

Tests: Added slider number input enhancement tests.

  • Loading branch information...
1 parent 9ffced2 commit 0a08df9367dce967be4382b0346b1483758d8aaa @jaspermdegroot jaspermdegroot committed Dec 3, 2012
Showing with 26 additions and 6 deletions.
  1. +13 −5 tests/unit/slider/index.html
  2. +3 −0 tests/unit/slider/settings.js
  3. +10 −1 tests/unit/slider/slider_core.js
@@ -12,8 +12,10 @@
<script src="../../../tests/jquery.testHelper.js"></script>
<script>
$.testHelper.asyncLoad([
+ [ "settings.js" ],
[
- "widgets/forms/slider"
+ "widgets/forms/slider",
+ "widgets/forms/textinput"
],
[
"slider_events.js",
@@ -107,10 +109,16 @@ <h2 id="qunit-userAgent"></h2>
<input type="range" name="slider" id="mouseup-refresh" value="25" min="0" max="100"/>
</div>
- <div data-role="fieldcontain">
- <label for="remove-events-slider">Input slider:</label>
- <input type="range" name="remove-events-slider" id="remove-events-slider" value="25" min="0" max="100"/>
- </div>
+ <div data-role="fieldcontain">
+ <label for="remove-events-slider">Input slider:</label>
+ <input type="range" name="remove-events-slider" id="remove-events-slider" value="25" min="0" max="100"/>
+ </div>
+
+ <div data-role="fieldcontain" class="textinput-test">
+ <label for="textinput-test">Input slider:</label>
+ <input type="range" data-clear-btn="true" name="slider" id="textinput-test" value="25" min="0" max="100"/>
+ </div>
+
</div>
<div id="enhancetest">
@@ -0,0 +1,3 @@
+$( document ).bind( "mobileinit", function() {
+ $.mobile.textinput.prototype.options.clearBtn = true;
+});
@@ -3,7 +3,7 @@
*/
(function($){
$.mobile.page.prototype.options.keepNative = "input.should-be-native";
-
+
module( "jquery.mobile.slider.js core" );
// not testing the positive case here since's it's obviously tested elsewhere
@@ -58,6 +58,15 @@
equal(label.attr( "id" ), slider.attr( "id" ) + "-label", "the label id is based off the slider id" );
});
+ // NOTE init binding to alter the setting is in settings.js
+ test( "slider input does not get clear button", function() {
+ deepEqual( $( ".textinput-test" ).find( ".ui-input-clear" ).length, 0, "slider input does not get clear button" );
+ });
+
+ test( "slider input is not wrapped in div.ui-input-text", function() {
+ ok( ! $( "#textinput-test" ).parents().is( "div.ui-input-text" ), "slider input is not wrapped in div.ui-input-text" );
+ });
+
test( "refresh is triggered on mouseup", function() {
expect( 1 );
var slider = $( "#mouseup-refresh" );

0 comments on commit 0a08df9

Please sign in to comment.