Skip to content

Commit

Permalink
Slider: Convert tests to new infrastructure
Browse files Browse the repository at this point in the history
Ref #10119
Ref jquerygh-1528
  • Loading branch information
scottgonzalez committed Apr 9, 2015
1 parent 3522fd9 commit a856dd9
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 41 deletions.
27 changes: 2 additions & 25 deletions tests/unit/slider/slider.html
Expand Up @@ -4,31 +4,8 @@
<meta charset="utf-8">
<title>jQuery UI Slider Test Suite</title>

<script src="../../jquery.js"></script>
<link rel="stylesheet" href="../../../external/qunit/qunit.css">
<script src="../../../external/qunit/qunit.js"></script>
<script src="../../../external/jquery-simulate/jquery.simulate.js"></script>
<script src="../testsuite.js"></script>
<script src="../../../external/qunit-assert-classes/qunit-assert-classes.js"></script>
<script>
TestHelpers.loadResources({
css: [ "core", "slider" ],
js: [
"ui/core.js",
"ui/widget.js",
"ui/mouse.js",
"ui/slider.js"
]
});
</script>

<script src="slider_common.js"></script>
<script src="slider_core.js"></script>
<script src="slider_events.js"></script>
<script src="slider_methods.js"></script>
<script src="slider_options.js"></script>

<script src="../swarminject.js"></script>
<script src="../../lib/css.js" data-modules="core slider"></script>
<script src="../../lib/bootstrap.js" data-widget="slider"></script>
</head>
<body>

Expand Down
9 changes: 8 additions & 1 deletion tests/unit/slider/slider_common.js
@@ -1,4 +1,9 @@
TestHelpers.commonWidgetTests( "slider", {
define( [
"lib/common",
"ui/slider"
], function( common ) {

common.testWidget( "slider", {
defaults: {
animate: false,
cancel: "input, textarea, button, select, option",
Expand Down Expand Up @@ -26,3 +31,5 @@ TestHelpers.commonWidgetTests( "slider", {
stop: null
}
});

} );
10 changes: 5 additions & 5 deletions tests/unit/slider/slider_core.js
@@ -1,7 +1,7 @@
(function( $ ) {
//
// Slider Test Helper Functions
//
define( [
"jquery",
"ui/slider"
], function( $ ) {

var element, options;

Expand Down Expand Up @@ -306,4 +306,4 @@ test( "keydown LEFT on handle decreases value by step, not less than min", funct
element.slider( "destroy" );
});

})( jQuery );
} );
7 changes: 5 additions & 2 deletions tests/unit/slider/slider_events.js
@@ -1,4 +1,7 @@
(function( $ ) {
define( [
"jquery",
"ui/slider"
], function( $ ) {

module( "slider: events" );

Expand Down Expand Up @@ -202,4 +205,4 @@ test( "event data", function() {
handles.eq( slideHandleIndex ).simulate( "drag", { dx: 10 } );
});

})( jQuery );
} );
11 changes: 7 additions & 4 deletions tests/unit/slider/slider_methods.js
@@ -1,4 +1,7 @@
(function( $ ) {
define( [
"jquery",
"ui/slider"
], function( $ ) {

module( "slider: methods" );

Expand All @@ -23,9 +26,9 @@ test( "init", function() {
ok( true, "arbitrary option setter after init" );
});

test( "destroy", function() {
test( "destroy", function( assert ) {
expect( 1 );
domEqual( "#slider1", function() {
assert.domEqual( "#slider1", function() {
$( "#slider1" ).slider().slider( "destroy" );
});
});
Expand Down Expand Up @@ -110,4 +113,4 @@ test( "value", function() {
// ok(false, "missing test - untested code is broken code." );
//});

})( jQuery );
} );
11 changes: 7 additions & 4 deletions tests/unit/slider/slider_options.js
@@ -1,4 +1,7 @@
(function( $ ) {
define( [
"jquery",
"ui/slider"
], function( $ ) {

var element, options;

Expand Down Expand Up @@ -54,7 +57,7 @@ test( "max", function() {
element.slider( options );
ok( element.slider( "option", "value" ) === options.value, "value option is not contained by max" );
ok( element.slider( "value" ) === options.max, "value method is contained by max" );

options = {
max: 9,
min: 1,
Expand All @@ -65,7 +68,7 @@ test( "max", function() {

element.slider( options );
ok( element.slider( "value" ) === 7, "value method is within max, edge Case" );

options.step = 2;

element.slider( options );
Expand Down Expand Up @@ -343,4 +346,4 @@ test( "range", function( assert ) {
element.slider( "destroy" );
});

})( jQuery );
} );

0 comments on commit a856dd9

Please sign in to comment.