From 8470b6a96552285a8b8e68fb86a8611d75d017d1 Mon Sep 17 00:00:00 2001 From: Amanpreet Singh Date: Sun, 3 Apr 2016 22:02:14 +0530 Subject: Droppable: Shift to use no globals --- tests/unit/droppable/options.js | 45 +++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'tests/unit/droppable/options.js') 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 = $( "
" ).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 = $( "
" ).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 = $( "
" ).appendTo( "#qunit-fixture" ).draggable( { revert: "invalid" } ), draggable2 = $( "
" ).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'); }); */ -- cgit v1.2.3