aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2016-09-02 10:21:25 -0400
committerScott González <scott.gonzalez@gmail.com>2016-09-13 08:41:33 -0400
commit51461d523868c168f2e12eeb547c1cf8b7cf59cf (patch)
tree152e7c29153c4ef8d69444a39a3e1a2172fca2ea /tests
parent57bff499deb880dd500be503231853c97b317234 (diff)
downloadjquery-ui-51461d523868c168f2e12eeb547c1cf8b7cf59cf.tar.gz
jquery-ui-51461d523868c168f2e12eeb547c1cf8b7cf59cf.zip
Slider: Add demo for custom handle
Fixes #15023 Closes gh-1740
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/slider/core.js12
-rw-r--r--tests/unit/slider/slider.html4
2 files changed, 14 insertions, 2 deletions
diff --git a/tests/unit/slider/core.js b/tests/unit/slider/core.js
index 57affb0d1..8031367f0 100644
--- a/tests/unit/slider/core.js
+++ b/tests/unit/slider/core.js
@@ -25,6 +25,18 @@ QUnit.test( "markup structure", function( assert ) {
assert.hasClasses( handle[ 1 ], "ui-slider-handle" );
} );
+QUnit.test( "custom handle", function( assert ) {
+ assert.expect( 3 );
+
+ var element = $( "#slider-custom-handle" ).slider();
+ var customHandle = $( ".custom-handle" );
+ var sliderHandles = element.find( ".ui-slider-handle" );
+
+ assert.equal( sliderHandles.length, 1, "Only one handle" );
+ assert.strictEqual( sliderHandles[ 0 ], customHandle[ 0 ], "Correct handle" );
+ assert.equal( customHandle.attr( "tabIndex" ), 0, "tabIndex" );
+} );
+
QUnit.test( "keydown HOME on handle sets value to min", function( assert ) {
assert.expect( 2 );
element = $( "<div></div>" );
diff --git a/tests/unit/slider/slider.html b/tests/unit/slider/slider.html
index 39bcd05c3..2afbeafde 100644
--- a/tests/unit/slider/slider.html
+++ b/tests/unit/slider/slider.html
@@ -25,8 +25,8 @@
<div id="slider1"></div>
<div id="slider2"></div>
-<div id="slider3" style="position: relative; margin: 40px; width: 217px; height: 28px;">
- <div class="ui-slider-handle" style="position: absolute; height: 21px; left: 0px; bottom: 0px; width: 17px;"></div>
+<div id="slider-custom-handle">
+ <div class="ui-slider-handle custom-handle"></div>
</div>
</div>