});
});
-test( "enable", function() {
- expect( 5 );
+test( "enable", function( assert ) {
+ expect( 3 );
var element,
expected = $( "<div></div>" ).slider(),
actual = expected.slider( "enable" );
equal(actual, expected, "enable is chainable" );
element = $( "<div></div>" ).slider({ disabled: true });
- ok( element.hasClass( "ui-state-disabled" ), "slider has ui-state-disabled class before enable method call" );
- ok( element.hasClass( "ui-slider-disabled" ), "slider has ui-slider-disabled class before enable method call" );
+ assert.hasClasses( element, "ui-state-disabled ui-slider-disabled" );
element.slider( "enable" );
- ok( !element.hasClass( "ui-state-disabled" ), "slider does not have ui-state-disabled class after enable method call" );
- ok( !element.hasClass( "ui-slider-disabled" ), "slider does not have ui-slider-disabled class after enable method call" );
+ assert.lacksClasses( element, "ui-state-disabled ui-slider-disabled" );
});
-test( "disable", function() {
- expect( 6 );
+test( "disable", function( assert ) {
+ expect( 4 );
var element,
expected = $( "<div></div>" ).slider(),
actual = expected.slider( "disable" );
equal(actual, expected, "disable is chainable" );
element = $( "<div></div>" ).slider({ disabled: false });
- ok( !element.hasClass( "ui-state-disabled" ), "slider does not have ui-state-disabled class before disabled method call" );
- ok( !element.hasClass( "ui-slider-disabled" ), "slider does not have ui-slider-disabled class before disable method call" );
+ assert.lacksClasses( element, "ui-state-disabled ui-slider-disabled" );
element.slider( "disable" );
- ok( element.hasClass( "ui-state-disabled" ), "slider has ui-state-disabled class after disable method call" );
- ok( element.hasClass( "ui-slider-disabled" ), "slider has ui-slider-disabled class after disable method call" );
+ assert.hasClasses( element, "ui-state-disabled ui-slider-disabled" );
ok( !element.attr( "aria-disabled" ), "slider does not have aria-disabled attr after disable method call" );
});
module( "slider: options" );
-test( "disabled", function(){
+test( "disabled", function( assert ){
expect( 8 );
var count = 0;
});
// enabled
- ok( !element.hasClass( "ui-slider-disabled" ), "no disabled class" );
+ assert.lacksClasses( element, "ui-slider-disabled" );
equal( element.slider( "option", "disabled" ), false , "is not disabled" );
handle().simulate( "drag", { dx: 10 } );
// disabled
element.slider( "option", "disabled", true );
- ok( element.hasClass( "ui-slider-disabled" ), "has disabled class" );
+ assert.hasClasses( element, "ui-slider-disabled" );
equal( element.slider( "option", "disabled" ), true, "is disabled" );
handle().simulate( "drag", { dx: 10 } );
});
-test( "orientation", function() {
+test( "orientation", function( assert ) {
expect( 8 );
element = $( "#slider1" );
var percentVal = ( options.value - options.min ) / ( options.max - options.min ) * 100;
element.slider( options ).slider( "option", "orientation", "horizontal" );
- ok( element.is( ".ui-slider-horizontal" ), "horizontal slider has class .ui-slider-horizontal" );
- ok( !element.is( ".ui-slider-vertical" ), "horizontal slider does not have class .ui-slider-vertical" );
+ assert.hasClasses( element, "ui-slider-horizontal" );
+ assert.lacksClasses( element, "ui-slider-vertical" );
equal( element.find( ".ui-slider-handle" )[ 0 ].style.bottom, "", "CSS bottom reset" );
equal( handle()[0].style.left, percentVal + "%", "horizontal slider handle is positioned with left: %" );
percentVal = ( options.value - options.min ) / ( options.max - options.min ) * 100;
element.slider( options ).slider( "option", "orientation", "vertical" );
- ok( element.is( ".ui-slider-vertical" ), "vertical slider has class .ui-slider-vertical" );
- ok( !element.is( ".ui-slider-horizontal" ), "vertical slider does not have class .ui-slider-horizontal" );
+ assert.hasClasses( element, "ui-slider-vertical" );
+ assert.lacksClasses( element, "ui-slider-horizontal" );
equal( element.find( ".ui-slider-handle" )[ 0 ].style.left, "", "CSS left reset" );
equal( handle()[0].style.bottom, percentVal + "%", "vertical slider handle is positioned with bottom: %" );
);
});
-test( "range", function() {
- expect( 33 );
+test( "range", function( assert ) {
+ expect( 32 );
var range;
// min
range = element.find( ".ui-slider-range" );
equal( element.find( ".ui-slider-handle" ).length, 2, "range true, two handles" );
- ok( !range.is( ".ui-slider-range-min" ), "range true" );
- ok( !range.is( ".ui-slider-range-max" ), "range true" );
+ assert.lacksClasses( range, "ui-slider-range-max ui-slider-range-min" );
element.slider( "destroy" );
// Change range from min to max