module("slider: core");
test("keydown HOME on handle sets value to min", function() {
+ expect( 2 );
el = $('<div></div>');
options = {
max: 5,
});
test("keydown END on handle sets value to max", function() {
+ expect( 2 );
el = $('<div></div>');
options = {
max: 5,
});
test("keydown PAGE_UP on handle increases value by 1/5 range, not greater than max", function() {
+ expect( 4 );
$.each(['horizontal', 'vertical'], function(i, orientation) {
el = $('<div></div>');
options = {
});
test("keydown PAGE_DOWN on handle decreases value by 1/5 range, not less than min", function() {
+ expect( 4 );
$.each(['horizontal', 'vertical'], function(i, orientation) {
el = $('<div></div>');
options = {
});
test("keydown UP on handle increases value by step, not greater than max", function() {
+ expect( 4 );
el = $('<div></div>');
options = {
max: 5,
});
test("keydown RIGHT on handle increases value by step, not greater than max", function() {
+ expect( 4 );
el = $('<div></div>');
options = {
max: 5,
});
test("keydown DOWN on handle decreases value by step, not less than min", function() {
+ expect( 4 );
el = $('<div></div>');
options = {
max: 5,
});
test("keydown LEFT on handle decreases value by step, not less than min", function() {
+ expect( 4 );
el = $('<div></div>');
options = {
max: 5,
test( "mouse based interaction", function() {
expect(4);
- var el = $( "<div></div>" )
- .appendTo( "body" )
+ var el = $( "#slider1" )
.slider({
start: function(event, ui) {
equal( event.originalEvent.type, "mousedown", "start triggered by mousedown" );
expect(3);
// Test keyup at end of handle slide (keyboard)
- var el = $( "<div></div>" )
- .appendTo( "body" )
+ var el = $( "#slider1" )
.slider({
start: function(event, ui) {
equal( event.originalEvent.type, "keydown", "start triggered by keydown" );
});
test("destroy", function() {
- $("<div></div>").appendTo('body').slider().slider("destroy").remove();
- ok(true, '.slider("destroy") called on element');
-
- $([]).slider().slider("destroy").remove();
- ok(true, '.slider("destroy") called on empty collection');
-
- $('<div></div>').appendTo('body').remove().slider().slider("destroy").remove();
- ok(true, '.slider("destroy") called on disconnected DOMElement');
-
- var expected = $('<div></div>').slider(),
- actual = expected.slider('destroy');
- equal(actual, expected, 'destroy is chainable');
+ expect( 1 );
+ domEqual( "#slider1", function() {
+ $( "#slider1" ).slider().slider( "destroy" );
+ });
});
test("enable", function() {
+ expect( 5 );
var el,
expected = $('<div></div>').slider(),
actual = expected.slider('enable');
});
test("disable", function() {
+ expect( 5 );
var el,
expected = $('<div></div>').slider(),
actual = expected.slider('disable');
});
test("value", function() {
+ expect( 17 );
$([false, 'min', 'max']).each(function() {
var el = $('<div></div>').slider({
range: this,
module("slider: options");
test("max", function() {
+ expect( 2 );
el = $('<div></div>');
options = {
});
test("min", function() {
+ expect( 2 );
el = $('<div></div>');
options = {
});
test("orientation", function() {
+ expect( 6 );
el = $('<div></div>');
options = {
// value option/method: the value option is not restricted by min/max/step.
// What is returned by the value method is restricted by min (>=), max (<=), and step (even multiple)
test("step", function() {
+ expect( 9 );
var el = $('<div></div>').slider({
min: 0,
value: 0,
el.slider("value", 19);
equal( el.slider("value"), 20 );
-el = $('<div></div>').slider({
+ el = $('<div></div>').slider({
min: 0,
value: 0,
step: 20,