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

Commit

Permalink
Tests: Added slider number input enhancement tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspermdegroot committed Dec 3, 2012
1 parent 9ffced2 commit 0a08df9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
18 changes: 13 additions & 5 deletions tests/unit/slider/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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">
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/slider/settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$( document ).bind( "mobileinit", function() {
$.mobile.textinput.prototype.options.clearBtn = true;
});
11 changes: 10 additions & 1 deletion tests/unit/slider/slider_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" );
Expand Down

0 comments on commit 0a08df9

Please sign in to comment.