aboutsummaryrefslogtreecommitdiffstats
path: root/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable
diff options
context:
space:
mode:
authorAlvin Li <liweitianux@gmail.com>2013-10-09 15:52:53 +0800
committerAlvin Li <liweitianux@gmail.com>2013-10-09 15:52:53 +0800
commit02afd8a32edb13ea7fc2266ac80092ea15c0930c (patch)
treec7a2a3f50378c017b425da47e04a71c6beaae56c /97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable
parentfafce2cfc72f4e1cd14ff6cb693c8ec7854159c5 (diff)
download97dev-02afd8a32edb13ea7fc2266ac80092ea15c0930c.tar.bz2
* treat 'apps/utils' as regular django app; which used to store
general tools for used in other apps * moved 'templatetags' from 'apps/indicator' to 'apps/utils' * '.gitignore' to ignore 'fixtures_bak' * moved js plugins from 'apps/indicator/static/plugins' to 'staticfiles/plugins' apps/recommend: * updated 'recommend.models'; o commented 'recommend.models.ResearchCombination' (not used) * implemented views 'add_edit_blog_info' and 'ajax_add_edit_configs'; * added pages 'templates/recommend/add_edit_blog_info.html', 'add_edit_blog_info_error.html'; o related css and javascripts files * added 'tools.py'; * added 'utils/tools.py' for placing generic functions; * deleted 'initial_data.json' (mv 'fixtures' to 'fixtures_bak'); * small fixes to 'indicator.models', 'sciblog.models' and 'sfaccount.views' * fixed automatically show 'proper_nouns' annotation in blog: recovered the line 'import signals' in 'sciblog.models' * added 'is_ok()' method for 'recommend.models.ResearchConfig';
Diffstat (limited to '97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable')
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/all.html30
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable.html50
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_common.js20
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_core.js29
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_events.js63
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_methods.js88
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_options.js67
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_test_helpers.js10
8 files changed, 357 insertions, 0 deletions
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/all.html b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/all.html
new file mode 100644
index 0000000..890e88a
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/all.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Droppable Test Suite</title>
+
+ <script src="../../../jquery-1.9.1.js"></script>
+
+ <link rel="stylesheet" href="../../../external/qunit.css">
+ <link rel="stylesheet" href="../qunit-composite.css">
+ <script src="../../../external/qunit.js"></script>
+ <script src="../qunit-composite.js"></script>
+ <script src="../subsuite.js"></script>
+
+ <script>
+ testAllVersions( "droppable" );
+ </script>
+</head>
+<body>
+
+<h1 id="qunit-header">jQuery UI Droppable Test Suite</h1>
+<h2 id="qunit-banner"></h2>
+<div id="qunit-testrunner-toolbar"></div>
+<h2 id="qunit-userAgent"></h2>
+<ol id="qunit-tests"></ol>
+<div id="qunit-fixture">
+
+</div>
+</body>
+</html>
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable.html b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable.html
new file mode 100644
index 0000000..d084464
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable.html
@@ -0,0 +1,50 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Droppable Test Suite</title>
+
+ <script src="../../jquery.js"></script>
+ <link rel="stylesheet" href="../../../external/qunit.css">
+ <script src="../../../external/qunit.js"></script>
+ <script src="../../jquery.simulate.js"></script>
+ <script src="../testsuite.js"></script>
+ <script>
+ TestHelpers.loadResources({
+ css: [ "ui.core" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.mouse.js",
+ "ui/jquery.ui.draggable.js",
+ "ui/jquery.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>
+</head>
+<body>
+
+<h1 id="qunit-header">jQuery UI Droppable Test Suite</h1>
+<h2 id="qunit-banner"></h2>
+<div id="qunit-testrunner-toolbar"></div>
+<h2 id="qunit-userAgent"></h2>
+<ol id="qunit-tests"></ol>
+<div id="qunit-fixture">
+
+<div id="draggable1" style="width: 25px; height: 25px;">Draggable</div>
+<div id="droppable1" style="width: 100px; height: 100px;">Droppable</div>
+<div id="droppable2" style="width: 100px; height: 100px;">Droppable</div>
+<div style='width:1000px;height:1000px;'>&nbsp;</div>
+
+</div>
+</body>
+</html>
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_common.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_common.js
new file mode 100644
index 0000000..c112def
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_common.js
@@ -0,0 +1,20 @@
+TestHelpers.commonWidgetTests( "droppable", {
+ defaults: {
+ accept: "*",
+ activeClass: false,
+ addClasses: true,
+ disabled: false,
+ greedy: false,
+ hoverClass: false,
+ scope: "default",
+ tolerance: "intersect",
+
+ // callbacks
+ activate: null,
+ create: null,
+ deactivate: null,
+ drop: null,
+ out: null,
+ over: null
+ }
+});
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_core.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_core.js
new file mode 100644
index 0000000..53b08fd
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_core.js
@@ -0,0 +1,29 @@
+/*
+ * droppable_core.js
+ */
+
+(function($) {
+
+module("droppable: core");
+
+test("element types", function() {
+ 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 );
+
+ $.each(typeNames, function(i) {
+ var typeName = typeNames[i],
+ el = $(document.createElement(typeName)).appendTo("body");
+
+ (typeName === "table" && el.append("<tr><td>content</td></tr>"));
+ el.droppable();
+ TestHelpers.droppable.shouldDrop();
+ el.droppable("destroy");
+ el.remove();
+ });
+});
+
+})(jQuery);
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_events.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_events.js
new file mode 100644
index 0000000..4b8fe5a
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_events.js
@@ -0,0 +1,63 @@
+(function( $ ) {
+
+module( "droppable: events" );
+
+test( "droppable destruction/recreation on drop event", function() {
+ expect( 1 );
+
+ var config = {
+ activeClass: "active",
+ drop: function() {
+ var element = $( this ),
+ newDroppable = $( "<div>" )
+ .css({ width: 100, height: 100 })
+ .text( "Droppable" );
+ element.after( newDroppable );
+ element.remove();
+ newDroppable.droppable( config );
+ }
+ },
+
+ draggable = $( "#draggable1" ).draggable(),
+ droppable1 = $( "#droppable1" ).droppable( config ),
+ droppable2 = $( "#droppable2" ).droppable( config ),
+
+ droppableOffset = droppable1.offset(),
+ draggableOffset = draggable.offset(),
+ dx = droppableOffset.left - draggableOffset.left,
+ dy = droppableOffset.top - draggableOffset.top;
+
+ draggable.simulate( "drag", {
+ dx: dx,
+ dy: dy
+ });
+
+ ok( !droppable2.hasClass( "active" ), "subsequent droppable no longer active" );
+});
+
+
+
+// todo: comment the following in when ready to actually test
+/*
+test("activate", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+
+test("deactivate", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+
+test("over", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+
+test("out", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+
+test("drop", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+*/
+
+})( jQuery );
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_methods.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_methods.js
new file mode 100644
index 0000000..2b452a6
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_methods.js
@@ -0,0 +1,88 @@
+/*
+ * droppable_methods.js
+ */
+(function($) {
+
+module("droppable: methods");
+
+test("init", function() {
+ expect( 5 );
+
+ $("<div></div>").appendTo("body").droppable().remove();
+ ok(true, ".droppable() called on element");
+
+ $([]).droppable();
+ ok(true, ".droppable() called on empty collection");
+
+ $("<div></div>").droppable();
+ ok(true, ".droppable() called on disconnected DOMElement");
+
+ $("<div></div>").droppable().droppable("option", "foo");
+ ok(true, "arbitrary option getter after init");
+
+ $("<div></div>").droppable().droppable("option", "foo", "bar");
+ ok(true, "arbitrary option setter after init");
+});
+
+test("destroy", function() {
+ expect( 4 );
+
+ $("<div></div>").appendTo("body").droppable().droppable("destroy").remove();
+ ok(true, ".droppable('destroy') called on element");
+
+ $([]).droppable().droppable("destroy");
+ ok(true, ".droppable('destroy') called on empty collection");
+
+ $("<div></div>").droppable().droppable("destroy");
+ ok(true, ".droppable('destroy') called on disconnected DOMElement");
+
+ var expected = $("<div></div>").droppable(),
+ actual = expected.droppable("destroy");
+ equal(actual, expected, "destroy is chainable");
+});
+
+test("enable", function() {
+ expect(7);
+
+ var el, expected, actual;
+
+ el = $("#droppable1").droppable({ disabled: true });
+ TestHelpers.droppable.shouldNotDrop();
+ el.droppable("enable");
+ TestHelpers.droppable.shouldDrop();
+ equal(el.droppable("option", "disabled"), false, "disabled option getter");
+ el.droppable("destroy");
+ el.droppable({ disabled: true });
+ TestHelpers.droppable.shouldNotDrop();
+ el.droppable("option", "disabled", false);
+ equal(el.droppable("option", "disabled"), false, "disabled option setter");
+ TestHelpers.droppable.shouldDrop();
+
+ expected = $("<div></div>").droppable(),
+ actual = expected.droppable("enable");
+ equal(actual, expected, "enable is chainable");
+});
+
+test("disable", function() {
+ expect(7);
+
+ var el, actual, expected;
+
+ el = $("#droppable1").droppable({ disabled: false });
+ TestHelpers.droppable.shouldDrop();
+ el.droppable("disable");
+ TestHelpers.droppable.shouldNotDrop();
+ equal(el.droppable("option", "disabled"), true, "disabled option getter");
+ el.droppable("destroy");
+ el.droppable({ disabled: false });
+ TestHelpers.droppable.shouldDrop();
+ el.droppable("option", "disabled", true);
+ equal(el.droppable("option", "disabled"), true, "disabled option setter");
+ TestHelpers.droppable.shouldNotDrop();
+
+ expected = $("<div></div>").droppable(),
+ actual = expected.droppable("disable");
+ equal(actual, expected, "disable is chainable");
+});
+
+})(jQuery);
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_options.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_options.js
new file mode 100644
index 0000000..c2ecdcf
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_options.js
@@ -0,0 +1,67 @@
+/*
+ * droppable_options.js
+ */
+(function($) {
+
+module("droppable: options");
+
+/*
+test("{ accept '*' }, default ", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+
+test("{ accept: Selector }", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+
+test("{ accept: function(draggable) }", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+
+test("activeClass", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+*/
+test("{ addClasses: true }, default", function() {
+ expect( 1 );
+ var el = $("<div></div>").droppable({ addClasses: true });
+ ok(el.is(".ui-droppable"), "'ui-droppable' class added");
+ el.droppable("destroy");
+});
+
+test("{ addClasses: false }", function() {
+ expect( 1 );
+ var el = $("<div></div>").droppable({ addClasses: false });
+ ok(!el.is(".ui-droppable"), "'ui-droppable' class not added");
+ el.droppable("destroy");
+});
+/*
+test("greedy", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+
+test("hoverClass", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+
+test("scope", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+
+test("tolerance, fit", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+
+test("tolerance, intersect", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+
+test("tolerance, pointer", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+
+test("tolerance, touch", function() {
+ ok(false, 'missing test - untested code is broken code');
+});
+*/
+})(jQuery);
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_test_helpers.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_test_helpers.js
new file mode 100644
index 0000000..ffd3745
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/droppable/droppable_test_helpers.js
@@ -0,0 +1,10 @@
+TestHelpers.droppable = {
+ shouldDrop: function() {
+ // todo: actually implement this
+ ok(true, "missing test - untested code is broken code");
+ },
+ shouldNotDrop: function() {
+ // todo: actually implement this
+ ok(true, "missing test - untested code is broken code");
+ }
+}; \ No newline at end of file