|
1 | 1 | define( [
|
| 2 | + "qunit", |
2 | 3 | "jquery",
|
3 | 4 | "./helper",
|
4 | 5 | "ui/widgets/droppable"
|
5 |
| -], function( $, testHelper ) { |
| 6 | +], function( QUnit, $, testHelper ) { |
6 | 7 |
|
7 |
| -module( "droppable: methods" ); |
| 8 | +QUnit.module( "droppable: methods" ); |
8 | 9 |
|
9 |
| -test( "init", function() { |
10 |
| - expect( 5 ); |
| 10 | +QUnit.test( "init", function( assert ) { |
| 11 | + assert.expect( 5 ); |
11 | 12 |
|
12 | 13 | $( "<div></div>" ).appendTo( "body" ).droppable().remove();
|
13 |
| - ok( true, ".droppable() called on element" ); |
| 14 | + assert.ok( true, ".droppable() called on element" ); |
14 | 15 |
|
15 | 16 | $( [] ).droppable();
|
16 |
| - ok( true, ".droppable() called on empty collection" ); |
| 17 | + assert.ok( true, ".droppable() called on empty collection" ); |
17 | 18 |
|
18 | 19 | $( "<div></div>" ).droppable();
|
19 |
| - ok( true, ".droppable() called on disconnected DOMElement" ); |
| 20 | + assert.ok( true, ".droppable() called on disconnected DOMElement" ); |
20 | 21 |
|
21 | 22 | $( "<div></div>" ).droppable().droppable( "option", "foo" );
|
22 |
| - ok( true, "arbitrary option getter after init" ); |
| 23 | + assert.ok( true, "arbitrary option getter after init" ); |
23 | 24 |
|
24 | 25 | $( "<div></div>" ).droppable().droppable( "option", "foo", "bar" );
|
25 |
| - ok( true, "arbitrary option setter after init" ); |
| 26 | + assert.ok( true, "arbitrary option setter after init" ); |
26 | 27 | } );
|
27 | 28 |
|
28 |
| -test( "destroy", function() { |
29 |
| - expect( 4 ); |
| 29 | +QUnit.test( "destroy", function( assert ) { |
| 30 | + assert.expect( 4 ); |
30 | 31 |
|
31 | 32 | $( "<div></div>" ).appendTo( "body" ).droppable().droppable( "destroy" ).remove();
|
32 |
| - ok( true, ".droppable('destroy') called on element" ); |
| 33 | + assert.ok( true, ".droppable('destroy') called on element" ); |
33 | 34 |
|
34 | 35 | $( [] ).droppable().droppable( "destroy" );
|
35 |
| - ok( true, ".droppable('destroy') called on empty collection" ); |
| 36 | + assert.ok( true, ".droppable('destroy') called on empty collection" ); |
36 | 37 |
|
37 | 38 | $( "<div></div>" ).droppable().droppable( "destroy" );
|
38 |
| - ok( true, ".droppable('destroy') called on disconnected DOMElement" ); |
| 39 | + assert.ok( true, ".droppable('destroy') called on disconnected DOMElement" ); |
39 | 40 |
|
40 | 41 | var expected = $( "<div></div>" ).droppable(),
|
41 | 42 | actual = expected.droppable( "destroy" );
|
42 |
| - equal( actual, expected, "destroy is chainable" ); |
| 43 | + assert.equal( actual, expected, "destroy is chainable" ); |
43 | 44 | } );
|
44 | 45 |
|
45 |
| -test( "enable", function() { |
46 |
| - expect( 7 ); |
| 46 | +QUnit.test( "enable", function( assert ) { |
| 47 | + assert.expect( 7 ); |
47 | 48 |
|
48 | 49 | var el, expected, actual;
|
49 | 50 |
|
50 | 51 | el = $( "#droppable1" ).droppable( { disabled: true } );
|
51 |
| - testHelper.shouldNotDrop(); |
| 52 | + testHelper.shouldNotDrop( assert ); |
52 | 53 | el.droppable( "enable" );
|
53 |
| - testHelper.shouldDrop(); |
54 |
| - equal( el.droppable( "option", "disabled" ), false, "disabled option getter" ); |
| 54 | + testHelper.shouldDrop( assert ); |
| 55 | + assert.equal( el.droppable( "option", "disabled" ), false, "disabled option getter" ); |
55 | 56 | el.droppable( "destroy" );
|
56 | 57 | el.droppable( { disabled: true } );
|
57 |
| - testHelper.shouldNotDrop(); |
| 58 | + testHelper.shouldNotDrop( assert ); |
58 | 59 | el.droppable( "option", "disabled", false );
|
59 |
| - equal( el.droppable( "option", "disabled" ), false, "disabled option setter" ); |
60 |
| - testHelper.shouldDrop(); |
| 60 | + assert.equal( el.droppable( "option", "disabled" ), false, "disabled option setter" ); |
| 61 | + testHelper.shouldDrop( assert ); |
61 | 62 |
|
62 | 63 | expected = $( "<div></div>" ).droppable(),
|
63 | 64 | actual = expected.droppable( "enable" );
|
64 |
| - equal( actual, expected, "enable is chainable" ); |
| 65 | + assert.equal( actual, expected, "enable is chainable" ); |
65 | 66 | } );
|
66 | 67 |
|
67 |
| -test( "disable", function( assert ) { |
68 |
| - expect( 10 ); |
| 68 | +QUnit.test( "disable", function( assert ) { |
| 69 | + assert.expect( 10 ); |
69 | 70 |
|
70 | 71 | var actual, expected,
|
71 | 72 | element = $( "#droppable1" ).droppable( { disabled: false } );
|
72 | 73 |
|
73 |
| - testHelper.shouldDrop(); |
| 74 | + testHelper.shouldDrop( assert ); |
74 | 75 | element.droppable( "disable" );
|
75 |
| - testHelper.shouldNotDrop(); |
76 |
| - equal( element.droppable( "option", "disabled" ), true, "disabled option getter" ); |
| 76 | + testHelper.shouldNotDrop( assert ); |
| 77 | + assert.equal( element.droppable( "option", "disabled" ), true, "disabled option getter" ); |
77 | 78 | element.droppable( "destroy" );
|
78 | 79 | element.droppable( { disabled: false } );
|
79 |
| - testHelper.shouldDrop(); |
| 80 | + testHelper.shouldDrop( assert ); |
80 | 81 | element.droppable( "option", "disabled", true );
|
81 | 82 | assert.lacksClasses( element.droppable( "widget" ), "ui-state-disabled" );
|
82 |
| - ok( !element.droppable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" ); |
| 83 | + assert.ok( !element.droppable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" ); |
83 | 84 | assert.hasClasses( element.droppable( "widget" ), "ui-droppable-disabled" );
|
84 |
| - equal( element.droppable( "option", "disabled" ), true, "disabled option setter" ); |
85 |
| - testHelper.shouldNotDrop(); |
| 85 | + assert.equal( element.droppable( "option", "disabled" ), true, "disabled option setter" ); |
| 86 | + testHelper.shouldNotDrop( assert ); |
86 | 87 |
|
87 | 88 | expected = $( "<div></div>" ).droppable();
|
88 | 89 | actual = expected.droppable( "disable" );
|
89 |
| - equal( actual, expected, "disable is chainable" ); |
| 90 | + assert.equal( actual, expected, "disable is chainable" ); |
90 | 91 | } );
|
91 | 92 |
|
92 | 93 | } );
|
0 commit comments