aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/selectable/events.js29
-rw-r--r--tests/unit/selectable/methods.js53
-rw-r--r--tests/unit/selectable/options.js23
3 files changed, 54 insertions, 51 deletions
diff --git a/tests/unit/selectable/events.js b/tests/unit/selectable/events.js
index 0e2e1384d..7f8e2baee 100644
--- a/tests/unit/selectable/events.js
+++ b/tests/unit/selectable/events.js
@@ -1,18 +1,19 @@
define( [
+ "qunit",
"jquery",
"lib/helper",
"ui/widgets/selectable"
-], function( $, testHelpers ) {
+], function( QUnit, $, testHelpers ) {
-module( "selectable: events" );
+QUnit.module( "selectable: events" );
-test( "start", function() {
- expect( 2 );
+QUnit.test( "start", function( assert ) {
+ assert.expect( 2 );
var el = $( "#selectable1" );
el.selectable( {
start: function() {
- ok( true, "drag fired start callback" );
- equal( this, el[ 0 ], "context of callback" );
+ assert.ok( true, "drag fired start callback" );
+ assert.equal( this, el[ 0 ], "context of callback" );
}
} );
el.simulate( "drag", {
@@ -21,13 +22,13 @@ test( "start", function() {
} );
} );
-test( "stop", function() {
- expect( 2 );
+QUnit.test( "stop", function( assert ) {
+ assert.expect( 2 );
var el = $( "#selectable1" );
el.selectable( {
start: function() {
- ok( true, "drag fired stop callback" );
- equal( this, el[ 0 ], "context of callback" );
+ assert.ok( true, "drag fired stop callback" );
+ assert.equal( this, el[ 0 ], "context of callback" );
}
} );
el.simulate( "drag", {
@@ -36,8 +37,8 @@ test( "stop", function() {
} );
} );
-test( "mousedown: initial position of helper", function() {
- expect( 2 );
+QUnit.test( "mousedown: initial position of helper", function( assert ) {
+ assert.expect( 2 );
var helperOffset,
element = $( "#selectable1" ).selectable(),
@@ -51,8 +52,8 @@ test( "mousedown: initial position of helper", function() {
} );
helperOffset = $( ".ui-selectable-helper" ).offset();
- ok( helperOffset.top, 110, "Scroll top should be accounted for." );
- ok( helperOffset.left, 110, "Scroll left should be accounted for." );
+ assert.ok( helperOffset.top, 110, "Scroll top should be accounted for." );
+ assert.ok( helperOffset.left, 110, "Scroll left should be accounted for." );
// Cleanup
element.simulate( "mouseup" );
diff --git a/tests/unit/selectable/methods.js b/tests/unit/selectable/methods.js
index 30160e975..c56c228bc 100644
--- a/tests/unit/selectable/methods.js
+++ b/tests/unit/selectable/methods.js
@@ -1,50 +1,51 @@
define( [
+ "qunit",
"jquery",
"ui/widgets/selectable"
-], function( $ ) {
+], function( QUnit, $ ) {
-module( "selectable: methods" );
+QUnit.module( "selectable: methods" );
-test( "init", function() {
- expect( 5 );
+QUnit.test( "init", function( assert ) {
+ assert.expect( 5 );
$( "<div></div>" ).appendTo( "body" ).selectable().remove();
- ok( true, ".selectable() called on element" );
+ assert.ok( true, ".selectable() called on element" );
$( [] ).selectable().remove();
- ok( true, ".selectable() called on empty collection" );
+ assert.ok( true, ".selectable() called on empty collection" );
$( "<div></div>" ).selectable().remove();
- ok( true, ".selectable() called on disconnected DOMElement" );
+ assert.ok( true, ".selectable() called on disconnected DOMElement" );
var el = $( "<div></div>" ).selectable();
el.selectable( "option", "foo" );
el.remove();
- ok( true, "arbitrary option getter after init" );
+ assert.ok( true, "arbitrary option getter after init" );
$( "<div></div>" ).selectable().selectable( "option", "foo", "bar" ).remove();
- ok( true, "arbitrary option setter after init" );
+ assert.ok( true, "arbitrary option setter after init" );
} );
-test( "destroy", function() {
- expect( 4 );
+QUnit.test( "destroy", function( assert ) {
+ assert.expect( 4 );
$( "<div></div>" ).appendTo( "body" ).selectable().selectable( "destroy" ).remove();
- ok( true, ".selectable('destroy') called on element" );
+ assert.ok( true, ".selectable('destroy') called on element" );
$( [] ).selectable().selectable( "destroy" ).remove();
- ok( true, ".selectable('destroy') called on empty collection" );
+ assert.ok( true, ".selectable('destroy') called on empty collection" );
$( "<div></div>" ).selectable().selectable( "destroy" ).remove();
- ok( true, ".selectable('destroy') called on disconnected DOMElement" );
+ assert.ok( true, ".selectable('destroy') called on disconnected DOMElement" );
var expected = $( "<div></div>" ).selectable(),
actual = expected.selectable( "destroy" );
- equal( actual, expected, "destroy is chainable" );
+ assert.equal( actual, expected, "destroy is chainable" );
} );
-test( "enable", function() {
- expect( 3 );
+QUnit.test( "enable", function( assert ) {
+ assert.expect( 3 );
var expected, actual,
fired = false,
el = $( "#selectable1" );
@@ -57,22 +58,22 @@ test( "enable", function() {
dx: 20,
dy: 20
} );
- equal( fired, false, "start fired" );
+ assert.equal( fired, false, "start fired" );
el.selectable( "enable" );
el.simulate( "drag", {
dx: 20,
dy: 20
} );
- equal( fired, true, "start fired" );
+ assert.equal( fired, true, "start fired" );
el.selectable( "destroy" );
expected = $( "<div></div>" ).selectable();
actual = expected.selectable( "enable" );
- equal( actual, expected, "enable is chainable" );
+ assert.equal( actual, expected, "enable is chainable" );
} );
-test( "disable", function( assert ) {
- expect( 6 );
+QUnit.test( "disable", function( assert ) {
+ assert.expect( 6 );
var chainable,
fired = false,
element = $( "#selectable1" );
@@ -87,7 +88,7 @@ test( "disable", function( assert ) {
dx: 20,
dy: 20
} );
- equal( fired, true, "start fired" );
+ assert.equal( fired, true, "start fired" );
chainable = element.selectable( "disable" );
fired = false;
@@ -96,16 +97,16 @@ test( "disable", function( assert ) {
dx: 20,
dy: 20
} );
- equal( fired, false, "start fired" );
+ assert.equal( fired, false, "start fired" );
assert.lacksClasses( element.selectable( "widget" ), "ui-state-disabled" );
- ok( !element.selectable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
+ assert.ok( !element.selectable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
assert.hasClasses( element.selectable( "widget" ), "ui-selectable-disabled" );
element.selectable( "destroy" );
- equal( chainable, element, "disable is chainable" );
+ assert.equal( chainable, element, "disable is chainable" );
} );
} );
diff --git a/tests/unit/selectable/options.js b/tests/unit/selectable/options.js
index df2f54f3e..58d4b6eb5 100644
--- a/tests/unit/selectable/options.js
+++ b/tests/unit/selectable/options.js
@@ -1,12 +1,13 @@
define( [
+ "qunit",
"jquery",
"ui/widgets/selectable"
-], function( $ ) {
+], function( QUnit, $ ) {
-module( "selectable: options" );
+QUnit.module( "selectable: options" );
-test( "autoRefresh", function() {
- expect( 3 );
+QUnit.test( "autoRefresh", function( assert ) {
+ assert.expect( 3 );
var actual = 0,
el = $( "#selectable1" ),
@@ -19,7 +20,7 @@ test( "autoRefresh", function() {
dx: 1000,
dy: 1000
} );
- equal( actual, sel.length );
+ assert.equal( actual, sel.length );
el.selectable( "destroy" );
actual = 0;
@@ -30,21 +31,21 @@ test( "autoRefresh", function() {
dx: 1000,
dy: 1000
} );
- equal( actual, 0 );
+ assert.equal( actual, 0 );
sel.show();
$( sel[ 0 ] ).simulate( "drag", {
dx: 1000,
dy: 1000
} );
- equal( actual, sel.length );
+ assert.equal( actual, sel.length );
el.selectable( "destroy" );
sel.show();
} );
-test( "filter", function() {
- expect( 2 );
+QUnit.test( "filter", function( assert ) {
+ assert.expect( 2 );
var actual = 0,
el = $( "#selectable1" ),
@@ -56,8 +57,8 @@ test( "filter", function() {
dx: 1000,
dy: 1000
} );
- ok( sel.length !== 1, "this test assumes more than 1 selectee" );
- equal( actual, 1 );
+ assert.ok( sel.length !== 1, "this test assumes more than 1 selectee" );
+ assert.equal( actual, 1 );
el.selectable( "destroy" );
} );