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 ],
( typeName === "table" && el.append( "<tr><td>content</td></tr>" ) );
el.droppable();
- testHelper.shouldDrop();
+ testHelper.shouldDrop( assert );
el.droppable( "destroy" );
el.remove();
} );
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",
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');
});
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" );
}
} );
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" );
} );
} );
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');
});
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(),
} );
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();
} );
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');
});
});
*/
-test( "tolerance, intersect", function() {
- expect( 2 );
+QUnit.test( "tolerance, intersect", function( assert ) {
+ assert.expect( 2 );
var draggable, droppable,
dataset = [
} );
droppable.off( "drop" ).on( "drop", function() {
- equal( true, data[ 2 ], data[ 3 ] );
+ assert.equal( true, data[ 2 ], data[ 3 ] );
} );
$( draggable ).simulate( "drag", {
} );
} );
-test( "tolerance, pointer", function() {
- expect( 3 );
+QUnit.test( "tolerance, pointer", function( assert ) {
+ assert.expect( 3 );
var draggable, droppable,
dataset = [
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", {
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", {
} );
/*
-test( "tolerance, touch", function() {
+Test( "tolerance, touch", function() {
ok(false, 'missing test - untested code is broken code');
});
*/