aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/droppable/core.js11
-rw-r--r--tests/unit/droppable/events.js13
-rw-r--r--tests/unit/droppable/helper.js15
-rw-r--r--tests/unit/droppable/methods.js69
-rw-r--r--tests/unit/droppable/options.js45
5 files changed, 79 insertions, 74 deletions
diff --git a/tests/unit/droppable/core.js b/tests/unit/droppable/core.js
index c4ce0378c..3d41e5db8 100644
--- a/tests/unit/droppable/core.js
+++ b/tests/unit/droppable/core.js
@@ -1,18 +1,19 @@
define( [
+ "qunit",
"jquery",
"./helper",
"ui/widgets/droppable"
-], function( $, testHelper ) {
+], function( QUnit, $, testHelper ) {
-module( "droppable: core" );
+QUnit.module( "droppable: core" );
-test( "element types", function() {
+QUnit.test( "element types", function( assert ) {
var typeNames = ( "p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form" +
",table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr" +
",acronym,code,samp,kbd,var,img,hr" +
",input,button,label,select,iframe" ).split( "," );
- expect( typeNames.length );
+ assert.expect( typeNames.length );
$.each( typeNames, function( i ) {
var typeName = typeNames[ i ],
@@ -20,7 +21,7 @@ test( "element types", function() {
( typeName === "table" && el.append( "<tr><td>content</td></tr>" ) );
el.droppable();
- testHelper.shouldDrop();
+ testHelper.shouldDrop( assert );
el.droppable( "destroy" );
el.remove();
} );
diff --git a/tests/unit/droppable/events.js b/tests/unit/droppable/events.js
index 68df6e506..8ccd7c87c 100644
--- a/tests/unit/droppable/events.js
+++ b/tests/unit/droppable/events.js
@@ -1,12 +1,13 @@
define( [
+ "qunit",
"jquery",
"ui/widgets/droppable"
-], function( $ ) {
+], function( QUnit, $ ) {
-module( "droppable: events" );
+QUnit.module( "droppable: events" );
-test( "droppable destruction/recreation on drop event", function( assert ) {
- expect( 1 );
+QUnit.test( "droppable destruction/recreation on drop event", function( assert ) {
+ assert.expect( 1 );
var config = {
activeClass: "active",
@@ -38,9 +39,9 @@ test( "droppable destruction/recreation on drop event", function( assert ) {
assert.lacksClasses( droppable2, "active", "subsequent droppable no longer active" );
} );
-// todo: comment the following in when ready to actually test
+// Todo: comment the following in when ready to actually test
/*
-test("activate", function() {
+Test("activate", function() {
ok(false, 'missing test - untested code is broken code');
});
diff --git a/tests/unit/droppable/helper.js b/tests/unit/droppable/helper.js
index b9bc5d6fb..f6bf9e411 100644
--- a/tests/unit/droppable/helper.js
+++ b/tests/unit/droppable/helper.js
@@ -1,19 +1,20 @@
define( [
+ "qunit",
"jquery",
"lib/helper"
-], function( $, helper ) {
+], function( QUnit, $, helper ) {
return $.extend( helper, {
- shouldDrop: function() {
+ shouldDrop: function( assert ) {
- // todo: actually implement this
- ok( true, "missing test - untested code is broken code" );
+ // Todo: actually implement this
+ assert.ok( true, "missing test - untested code is broken code" );
},
- shouldNotDrop: function() {
+ shouldNotDrop: function( assert ) {
- // todo: actually implement this
- ok( true, "missing test - untested code is broken code" );
+ // Todo: actually implement this
+ assert.ok( true, "missing test - untested code is broken code" );
}
} );
diff --git a/tests/unit/droppable/methods.js b/tests/unit/droppable/methods.js
index c159be56f..433615d16 100644
--- a/tests/unit/droppable/methods.js
+++ b/tests/unit/droppable/methods.js
@@ -1,92 +1,93 @@
define( [
+ "qunit",
"jquery",
"./helper",
"ui/widgets/droppable"
-], function( $, testHelper ) {
+], function( QUnit, $, testHelper ) {
-module( "droppable: methods" );
+QUnit.module( "droppable: methods" );
-test( "init", function() {
- expect( 5 );
+QUnit.test( "init", function( assert ) {
+ assert.expect( 5 );
$( "<div></div>" ).appendTo( "body" ).droppable().remove();
- ok( true, ".droppable() called on element" );
+ assert.ok( true, ".droppable() called on element" );
$( [] ).droppable();
- ok( true, ".droppable() called on empty collection" );
+ assert.ok( true, ".droppable() called on empty collection" );
$( "<div></div>" ).droppable();
- ok( true, ".droppable() called on disconnected DOMElement" );
+ assert.ok( true, ".droppable() called on disconnected DOMElement" );
$( "<div></div>" ).droppable().droppable( "option", "foo" );
- ok( true, "arbitrary option getter after init" );
+ assert.ok( true, "arbitrary option getter after init" );
$( "<div></div>" ).droppable().droppable( "option", "foo", "bar" );
- 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" ).droppable().droppable( "destroy" ).remove();
- ok( true, ".droppable('destroy') called on element" );
+ assert.ok( true, ".droppable('destroy') called on element" );
$( [] ).droppable().droppable( "destroy" );
- ok( true, ".droppable('destroy') called on empty collection" );
+ assert.ok( true, ".droppable('destroy') called on empty collection" );
$( "<div></div>" ).droppable().droppable( "destroy" );
- ok( true, ".droppable('destroy') called on disconnected DOMElement" );
+ assert.ok( true, ".droppable('destroy') called on disconnected DOMElement" );
var expected = $( "<div></div>" ).droppable(),
actual = expected.droppable( "destroy" );
- equal( actual, expected, "destroy is chainable" );
+ assert.equal( actual, expected, "destroy is chainable" );
} );
-test( "enable", function() {
- expect( 7 );
+QUnit.test( "enable", function( assert ) {
+ assert.expect( 7 );
var el, expected, actual;
el = $( "#droppable1" ).droppable( { disabled: true } );
- testHelper.shouldNotDrop();
+ testHelper.shouldNotDrop( assert );
el.droppable( "enable" );
- testHelper.shouldDrop();
- equal( el.droppable( "option", "disabled" ), false, "disabled option getter" );
+ testHelper.shouldDrop( assert );
+ assert.equal( el.droppable( "option", "disabled" ), false, "disabled option getter" );
el.droppable( "destroy" );
el.droppable( { disabled: true } );
- testHelper.shouldNotDrop();
+ testHelper.shouldNotDrop( assert );
el.droppable( "option", "disabled", false );
- equal( el.droppable( "option", "disabled" ), false, "disabled option setter" );
- testHelper.shouldDrop();
+ assert.equal( el.droppable( "option", "disabled" ), false, "disabled option setter" );
+ testHelper.shouldDrop( assert );
expected = $( "<div></div>" ).droppable(),
actual = expected.droppable( "enable" );
- equal( actual, expected, "enable is chainable" );
+ assert.equal( actual, expected, "enable is chainable" );
} );
-test( "disable", function( assert ) {
- expect( 10 );
+QUnit.test( "disable", function( assert ) {
+ assert.expect( 10 );
var actual, expected,
element = $( "#droppable1" ).droppable( { disabled: false } );
- testHelper.shouldDrop();
+ testHelper.shouldDrop( assert );
element.droppable( "disable" );
- testHelper.shouldNotDrop();
- equal( element.droppable( "option", "disabled" ), true, "disabled option getter" );
+ testHelper.shouldNotDrop( assert );
+ assert.equal( element.droppable( "option", "disabled" ), true, "disabled option getter" );
element.droppable( "destroy" );
element.droppable( { disabled: false } );
- testHelper.shouldDrop();
+ testHelper.shouldDrop( assert );
element.droppable( "option", "disabled", true );
assert.lacksClasses( element.droppable( "widget" ), "ui-state-disabled" );
- ok( !element.droppable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
+ assert.ok( !element.droppable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
assert.hasClasses( element.droppable( "widget" ), "ui-droppable-disabled" );
- equal( element.droppable( "option", "disabled" ), true, "disabled option setter" );
- testHelper.shouldNotDrop();
+ assert.equal( element.droppable( "option", "disabled" ), true, "disabled option setter" );
+ testHelper.shouldNotDrop( assert );
expected = $( "<div></div>" ).droppable();
actual = expected.droppable( "disable" );
- equal( actual, expected, "disable is chainable" );
+ assert.equal( actual, expected, "disable is chainable" );
} );
} );
diff --git a/tests/unit/droppable/options.js b/tests/unit/droppable/options.js
index 856c2d215..1c164495b 100644
--- a/tests/unit/droppable/options.js
+++ b/tests/unit/droppable/options.js
@@ -1,12 +1,13 @@
define( [
+ "qunit",
"jquery",
"ui/widgets/droppable"
-], function( $ ) {
+], function( QUnit, $ ) {
-module( "droppable: options" );
+QUnit.module( "droppable: options" );
/*
-test( "{ accept '*' }, default ", function() {
+Test( "{ accept '*' }, default ", function() {
ok(false, 'missing test - untested code is broken code');
});
@@ -22,23 +23,23 @@ test( "activeClass", function() {
ok(false, 'missing test - untested code is broken code');
});
*/
-test( "{ addClasses: true }, default", function( assert ) {
- expect( 1 );
+QUnit.test( "{ addClasses: true }, default", function( assert ) {
+ assert.expect( 1 );
var el = $( "<div />" ).droppable( { addClasses: true } );
assert.hasClasses( el, "ui-droppable" );
el.droppable( "destroy" );
} );
-test( "{ addClasses: false }", function( assert ) {
- expect( 1 );
+QUnit.test( "{ addClasses: false }", function( assert ) {
+ assert.expect( 1 );
var el = $( "<div />" ).droppable( { addClasses: false } );
assert.lacksClasses( el, "ui-droppable" );
el.droppable( "destroy" );
} );
-test( "scope", function() {
- expect( 4 );
+QUnit.test( "scope", function( assert ) {
+ assert.expect( 4 );
var droppableOffset, draggableOffset, oldDraggableOffset, dx, dy,
draggable1 = $( "<div />" ).appendTo( "#qunit-fixture" ).draggable( { revert: "invalid" } ),
draggable2 = $( "<div />" ).appendTo( "#qunit-fixture" ).droppable(),
@@ -60,8 +61,8 @@ test( "scope", function() {
} );
draggableOffset = draggable1.offset();
- equal( draggableOffset.left, droppableOffset.left );
- equal( draggableOffset.top, droppableOffset.top );
+ assert.equal( draggableOffset.left, droppableOffset.left );
+ assert.equal( draggableOffset.top, droppableOffset.top );
// Test that droppable doesn't accept draggable with old scope.
draggableOffset = draggable2.offset();
@@ -75,11 +76,11 @@ test( "scope", function() {
} );
draggableOffset = draggable2.offset();
- equal( draggableOffset.left, oldDraggableOffset.left );
- equal( draggableOffset.top, oldDraggableOffset.top );
+ assert.equal( draggableOffset.left, oldDraggableOffset.left );
+ assert.equal( draggableOffset.top, oldDraggableOffset.top );
} );
/*
-test( "greedy", function() {
+Test( "greedy", function() {
ok(false, 'missing test - untested code is broken code');
});
@@ -92,8 +93,8 @@ test( "tolerance, fit", function() {
});
*/
-test( "tolerance, intersect", function() {
- expect( 2 );
+QUnit.test( "tolerance, intersect", function( assert ) {
+ assert.expect( 2 );
var draggable, droppable,
dataset = [
@@ -135,7 +136,7 @@ test( "tolerance, intersect", function() {
} );
droppable.off( "drop" ).on( "drop", function() {
- equal( true, data[ 2 ], data[ 3 ] );
+ assert.equal( true, data[ 2 ], data[ 3 ] );
} );
$( draggable ).simulate( "drag", {
@@ -145,8 +146,8 @@ test( "tolerance, intersect", function() {
} );
} );
-test( "tolerance, pointer", function() {
- expect( 3 );
+QUnit.test( "tolerance, pointer", function( assert ) {
+ assert.expect( 3 );
var draggable, droppable,
dataset = [
@@ -174,7 +175,7 @@ test( "tolerance, pointer", function() {
var data = this;
droppable.off( "drop" ).on( "drop", function() {
- equal( true, data[ 2 ], data[ 3 ] );
+ assert.equal( true, data[ 2 ], data[ 3 ] );
} );
$( draggable ).simulate( "drag", {
@@ -188,7 +189,7 @@ test( "tolerance, pointer", function() {
droppable.css( { top: 15, left: 15 } );
droppable.off( "drop" ).on( "drop", function() {
- ok( true, "drop fires as long as pointer is within droppable" );
+ assert.ok( true, "drop fires as long as pointer is within droppable" );
} );
$( draggable ).simulate( "drag", {
@@ -198,7 +199,7 @@ test( "tolerance, pointer", function() {
} );
/*
-test( "tolerance, touch", function() {
+Test( "tolerance, touch", function() {
ok(false, 'missing test - untested code is broken code');
});
*/