Skip to content
Permalink
Browse files

Droppable: Convert tests to new infrastructure

Ref #10119
Ref gh-1528
  • Loading branch information...
scottgonzalez committed Apr 7, 2015
1 parent a2da340 commit 669e62d61b52a31efc7666bf95d0bfe2df2f839d
@@ -4,36 +4,9 @@
<meta charset="utf-8">
<title>jQuery UI Droppable Test Suite</title>

<script src="../../jquery.js"></script>
<script>
$.uiBackCompat = false;
</script>
<link rel="stylesheet" href="../../../external/qunit/qunit.css">
<script src="../../../external/qunit/qunit.js"></script>
<script src="../../../external/jquery-simulate/jquery.simulate.js"></script>
<script src="../testsuite.js"></script>
<script src="../../../external/qunit-assert-classes/qunit-assert-classes.js"></script>
<script>
TestHelpers.loadResources({
css: [ "core" ],
js: [
"ui/core.js",
"ui/widget.js",
"ui/mouse.js",
"ui/draggable.js",
"ui/droppable.js"
]
});
</script>

<script src="droppable_common.js"></script>
<script src="droppable_core.js"></script>
<script src="droppable_events.js"></script>
<script src="droppable_methods.js"></script>
<script src="droppable_options.js"></script>
<script src="droppable_test_helpers.js"></script>

<script src="../swarminject.js"></script>
<script src="../../lib/css.js" data-modules="core"></script>
<script src="../../lib/bootstrap.js" data-widget="droppable"
data-no-back-compat="true"></script>
</head>
<body>

@@ -1,4 +1,9 @@
TestHelpers.commonWidgetTests( "droppable", {
define( [
"lib/common",
"ui/droppable"
], function( common ) {

common.testWidget( "droppable", {
defaults: {
accept: "*",
addClasses: true,
@@ -17,3 +22,5 @@ TestHelpers.commonWidgetTests( "droppable", {
over: null
}
});

} );
@@ -1,4 +1,9 @@
TestHelpers.commonWidgetTests( "droppable", {
define( [
"lib/common",
"ui/droppable"
], function( common ) {

common.testWidget( "droppable", {
defaults: {
accept: "*",
activeClass: false,
@@ -19,3 +24,5 @@ TestHelpers.commonWidgetTests( "droppable", {
over: null
}
});

} );
@@ -1,8 +1,8 @@
/*
* droppable_core.js
*/

(function($) {
define( [
"jquery",
"./droppable_test_helpers",
"ui/droppable"
], function( $, droppableTestHelpers ) {

module("droppable: core");

@@ -20,10 +20,10 @@ test("element types", function() {

(typeName === "table" && el.append("<tr><td>content</td></tr>"));
el.droppable();
TestHelpers.droppable.shouldDrop();
droppableTestHelpers.shouldDrop();
el.droppable("destroy");
el.remove();
});
});

})(jQuery);
} );
@@ -4,33 +4,8 @@
<meta charset="utf-8">
<title>jQuery UI Droppable Test Suite</title>

<script src="../../jquery.js"></script>
<link rel="stylesheet" href="../../../external/qunit/qunit.css">
<script src="../../../external/qunit/qunit.js"></script>
<script src="../../../external/jquery-simulate/jquery.simulate.js"></script>
<script src="../testsuite.js"></script>
<script src="../../../external/qunit-assert-classes/qunit-assert-classes.js"></script>
<script>
TestHelpers.loadResources({
css: [ "core" ],
js: [
"ui/core.js",
"ui/widget.js",
"ui/mouse.js",
"ui/draggable.js",
"ui/droppable.js"
]
});
</script>

<script src="droppable_common_deprecated.js"></script>
<script src="droppable_core.js"></script>
<script src="droppable_events.js"></script>
<script src="droppable_methods.js"></script>
<script src="droppable_options.js"></script>
<script src="droppable_test_helpers.js"></script>

<script src="../swarminject.js"></script>
<script src="../../lib/css.js" data-modules="core"></script>
<script src="../../lib/bootstrap.js" data-widget="droppable" data-deprecated="true"></script>
</head>
<body>

@@ -0,0 +1 @@
define( function() {} );
@@ -1,4 +1,7 @@
(function( $ ) {
define( [
"jquery",
"ui/droppable"
], function( $ ) {

module( "droppable: events" );

@@ -58,4 +61,4 @@ test("drop", function() {
});
*/

})( jQuery );
} );
@@ -1,7 +1,8 @@
/*
* droppable_methods.js
*/
(function($) {
define( [
"jquery",
"./droppable_test_helpers",
"ui/droppable"
], function( $, droppableTestHelpers ) {

module("droppable: methods");

@@ -47,16 +48,16 @@ test("enable", function() {
var el, expected, actual;

el = $("#droppable1").droppable({ disabled: true });
TestHelpers.droppable.shouldNotDrop();
droppableTestHelpers.shouldNotDrop();
el.droppable("enable");
TestHelpers.droppable.shouldDrop();
droppableTestHelpers.shouldDrop();
equal(el.droppable("option", "disabled"), false, "disabled option getter");
el.droppable("destroy");
el.droppable({ disabled: true });
TestHelpers.droppable.shouldNotDrop();
droppableTestHelpers.shouldNotDrop();
el.droppable("option", "disabled", false);
equal(el.droppable("option", "disabled"), false, "disabled option setter");
TestHelpers.droppable.shouldDrop();
droppableTestHelpers.shouldDrop();

expected = $("<div></div>").droppable(),
actual = expected.droppable("enable");
@@ -69,23 +70,23 @@ test( "disable", function( assert ) {
var actual, expected,
element = $( "#droppable1" ).droppable({ disabled: false });

TestHelpers.droppable.shouldDrop();
droppableTestHelpers.shouldDrop();
element.droppable( "disable" );
TestHelpers.droppable.shouldNotDrop();
droppableTestHelpers.shouldNotDrop();
equal( element.droppable( "option", "disabled" ), true, "disabled option getter" );
element.droppable( "destroy" );
element.droppable({ disabled: false });
TestHelpers.droppable.shouldDrop();
droppableTestHelpers.shouldDrop();
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.hasClasses( element.droppable( "widget" ), "ui-droppable-disabled" );
equal( element.droppable( "option", "disabled" ), true, "disabled option setter" );
TestHelpers.droppable.shouldNotDrop();
droppableTestHelpers.shouldNotDrop();

expected = $( "<div></div>" ).droppable();
actual = expected.droppable( "disable" );
equal( actual, expected, "disable is chainable" );
});

})( jQuery );
} );
@@ -1,7 +1,8 @@
/*
* droppable_options.js
*/
(function($) {
define( [
"jquery",
"./droppable_test_helpers",
"ui/droppable"
], function( $ ) {

module( "droppable: options" );

@@ -202,4 +203,4 @@ test( "tolerance, touch", function() {
ok(false, 'missing test - untested code is broken code');
});
*/
})(jQuery);
} );
@@ -1,4 +1,6 @@
TestHelpers.droppable = {
define( function() {

return {
shouldDrop: function() {
// todo: actually implement this
ok(true, "missing test - untested code is broken code");
@@ -8,3 +10,5 @@ TestHelpers.droppable = {
ok(true, "missing test - untested code is broken code");
}
};

} );

0 comments on commit 669e62d

Please sign in to comment.
You can’t perform that action at this time.