From 02afd8a32edb13ea7fc2266ac80092ea15c0930c Mon Sep 17 00:00:00 2001 From: Alvin Li Date: Wed, 9 Oct 2013 15:52:53 +0800 Subject: * 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'; --- .../plugins/jquery-ui/tests/unit/sortable/all.html | 30 ++ .../jquery-ui/tests/unit/sortable/sortable.html | 99 +++++ .../tests/unit/sortable/sortable_common.js | 45 ++ .../jquery-ui/tests/unit/sortable/sortable_core.js | 3 + .../tests/unit/sortable/sortable_events.js | 275 ++++++++++++ .../tests/unit/sortable/sortable_methods.js | 92 +++++ .../tests/unit/sortable/sortable_options.js | 460 +++++++++++++++++++++ .../tests/unit/sortable/sortable_test_helpers.js | 9 + 8 files changed, 1013 insertions(+) create mode 100644 97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/all.html create mode 100644 97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable.html create mode 100644 97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_common.js create mode 100644 97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_core.js create mode 100644 97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_events.js create mode 100644 97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_methods.js create mode 100644 97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_options.js create mode 100644 97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_test_helpers.js (limited to '97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable') diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/all.html b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/all.html new file mode 100644 index 0000000..060883e --- /dev/null +++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/all.html @@ -0,0 +1,30 @@ + + + + + jQuery UI Sortable Test Suite + + + + + + + + + + + + + +

jQuery UI Sortable Test Suite

+

+
+

+
    +
    + +
    + + diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable.html b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable.html new file mode 100644 index 0000000..8e0bac5 --- /dev/null +++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable.html @@ -0,0 +1,99 @@ + + + + + jQuery UI Sortable Test Suite + + + + + + + + + + + + + + + + + + + + +

    jQuery UI Sortable Test Suite

    +

    +
    +

    +
      +
      + + + + + + + + + + + + + + + + + + + + + + +
      12
      34
      56
      78
      + +
      + + + + +
      + +
      + + diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_common.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_common.js new file mode 100644 index 0000000..86850a6 --- /dev/null +++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_common.js @@ -0,0 +1,45 @@ +TestHelpers.commonWidgetTests( "sortable", { + defaults: { + appendTo: "parent", + axis: false, + cancel: "input,textarea,button,select,option", + connectWith: false, + containment: false, + cursor: "auto", + cursorAt: false, + delay: 0, + disabled: false, + distance: 1, + dropOnEmpty: true, + forcePlaceholderSize: false, + forceHelperSize: false, + grid: false, + handle: false, + helper: "original", + items: "> *", + opacity: false, + placeholder: false, + revert: false, + scroll: true, + scrollSensitivity: 20, + scrollSpeed: 20, + scope: "default", + tolerance: "intersect", + zIndex: 1000, + + // callbacks + activate: null, + beforeStop: null, + change: null, + create: null, + deactivate: null, + out: null, + over: null, + receive: null, + remove: null, + sort: null, + start: null, + stop: null, + update: null + } +}); diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_core.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_core.js new file mode 100644 index 0000000..211f8ac --- /dev/null +++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_core.js @@ -0,0 +1,3 @@ +/* + * sortable_core.js + */ \ No newline at end of file diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_events.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_events.js new file mode 100644 index 0000000..46a493b --- /dev/null +++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_events.js @@ -0,0 +1,275 @@ +/* + * sortable_events.js + */ +(function($) { + +module("sortable: events"); + +test("start", function() { + expect( 7 ); + + var hash; + $("#sortable").sortable({ + start: function( e, ui ) { + hash = ui; + } + }).find("li:eq(0)").simulate( "drag", { + dy: 10 + }); + + ok(hash, "start event triggered"); + ok(hash.helper, "UI hash includes: helper"); + ok(hash.placeholder, "UI hash includes: placeholder"); + ok(hash.item, "UI hash includes: item"); + ok(!hash.sender, "UI hash does not include: sender"); + + // todo: see if these events should actually have sane values in them + ok("position" in hash, "UI hash includes: position"); + ok("offset" in hash, "UI hash includes: offset"); + + +}); + +test("sort", function() { + expect( 7 ); + + var hash; + $("#sortable").sortable({ + sort: function( e, ui ) { + hash = ui; + } + }).find("li:eq(0)").simulate( "drag", { + dy: 10 + }); + + ok(hash, "sort event triggered"); + ok(hash.helper, "UI hash includes: helper"); + ok(hash.placeholder, "UI hash includes: placeholder"); + ok(hash.position && ("top" in hash.position && "left" in hash.position), "UI hash includes: position"); + ok(hash.offset && (hash.offset.top && hash.offset.left), "UI hash includes: offset"); + ok(hash.item, "UI hash includes: item"); + ok(!hash.sender, "UI hash does not include: sender"); + +}); + +test("change", function() { + expect( 8 ); + + var hash; + $("#sortable").sortable({ + change: function( e, ui ) { + hash = ui; + } + }).find("li:eq(0)").simulate( "drag", { + dx: 1, + dy: 1 + }); + + ok(!hash, "1px drag, change event should not be triggered"); + + $("#sortable").sortable({ + change: function( e, ui ) { + hash = ui; + } + }).find("li:eq(0)").simulate( "drag", { + dy: 22 + }); + + ok(hash, "change event triggered"); + ok(hash.helper, "UI hash includes: helper"); + ok(hash.placeholder, "UI hash includes: placeholder"); + ok(hash.position && ("top" in hash.position && "left" in hash.position), "UI hash includes: position"); + ok(hash.offset && (hash.offset.top && hash.offset.left), "UI hash includes: offset"); + ok(hash.item, "UI hash includes: item"); + ok(!hash.sender, "UI hash does not include: sender"); + +}); + +test("beforeStop", function() { + expect( 7 ); + + var hash; + $("#sortable").sortable({ + beforeStop: function( e, ui ) { + hash = ui; + } + }).find("li:eq(0)").simulate( "drag", { + dy: 20 + }); + + ok(hash, "beforeStop event triggered"); + ok(hash.helper, "UI hash includes: helper"); + ok(hash.placeholder, "UI hash includes: placeholder"); + ok(hash.position && ("top" in hash.position && "left" in hash.position), "UI hash includes: position"); + ok(hash.offset && (hash.offset.top && hash.offset.left), "UI hash includes: offset"); + ok(hash.item, "UI hash includes: item"); + ok(!hash.sender, "UI hash does not include: sender"); + +}); + +test("stop", function() { + expect( 7 ); + + var hash; + $("#sortable").sortable({ + stop: function( e, ui ) { + hash = ui; + } + }).find("li:eq(0)").simulate( "drag", { + dy: 20 + }); + + ok(hash, "stop event triggered"); + ok(!hash.helper, "UI should not include: helper"); + ok(hash.placeholder, "UI hash includes: placeholder"); + ok(hash.position && ("top" in hash.position && "left" in hash.position), "UI hash includes: position"); + ok(hash.offset && (hash.offset.top && hash.offset.left), "UI hash includes: offset"); + ok(hash.item, "UI hash includes: item"); + ok(!hash.sender, "UI hash does not include: sender"); + +}); + +test("update", function() { + expect( 8 ); + + var hash; + $("#sortable").sortable({ + update: function( e, ui ) { + hash = ui; + } + }).find("li:eq(0)").simulate( "drag", { + dx: 1, + dy: 1 + }); + + ok(!hash, "1px drag, update event should not be triggered"); + + $("#sortable").sortable({ + update: function( e, ui ) { + hash = ui; + } + }).find("li:eq(0)").simulate( "drag", { + dy: 22 + }); + + ok(hash, "update event triggered"); + ok(!hash.helper, "UI hash should not include: helper"); + ok(hash.placeholder, "UI hash includes: placeholder"); + ok(hash.position && ("top" in hash.position && "left" in hash.position), "UI hash includes: position"); + ok(hash.offset && (hash.offset.top && hash.offset.left), "UI hash includes: offset"); + ok(hash.item, "UI hash includes: item"); + ok(!hash.sender, "UI hash does not include: sender"); + +}); + +test("#3019: Stop fires too early", function() { + expect(2); + + var helper = null, + el = $("#sortable").sortable({ + stop: function(event, ui) { + helper = ui.helper; + } + }); + + TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, "Dragging the sortable"); + equal(helper, null, "helper should be false"); + +}); + +test("#4752: link event firing on sortable with connect list", function () { + expect( 10 ); + + var fired = {}, + hasFired = function (type) { return (type in fired) && (true === fired[type]); }; + + $("#sortable").clone().attr("id", "sortable2").insertAfter("#sortable"); + + $("#qunit-fixture ul").sortable({ + connectWith: "#qunit-fixture ul", + change: function () { + fired.change = true; + }, + receive: function () { + fired.receive = true; + }, + remove: function () { + fired.remove = true; + } + }); + + $("#qunit-fixture ul").bind("click.ui-sortable-test", function () { + fired.click = true; + }); + + $("#sortable li:eq(0)").simulate("click"); + ok(!hasFired("change"), "Click only, change event should not have fired"); + ok(hasFired("click"), "Click event should have fired"); + + // Drag an item within the first list + fired = {}; + $("#sortable li:eq(0)").simulate("drag", { dx: 0, dy: 40 }); + ok(hasFired("change"), "40px drag, change event should have fired"); + ok(!hasFired("receive"), "Receive event should not have fired"); + ok(!hasFired("remove"), "Remove event should not have fired"); + ok(!hasFired("click"), "Click event should not have fired"); + + // Drag an item from the first list to the second, connected list + fired = {}; + $("#sortable li:eq(0)").simulate("drag", { dx: 0, dy: 150 }); + ok(hasFired("change"), "150px drag, change event should have fired"); + ok(hasFired("receive"), "Receive event should have fired"); + ok(hasFired("remove"), "Remove event should have fired"); + ok(!hasFired("click"), "Click event should not have fired"); +}); + +/* +test("receive", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("remove", function() { + ok(false, "missing test - untested code is broken code."); +}); +*/ + +test( "over", function() { + expect( 8 ); + + var hash, + overCount = 0; + + $( "#sortable" ).sortable({ + over: function( e, ui ) { + hash = ui; + overCount++; + } + }).find( "li:eq(0)" ).simulate( "drag", { + dy: 20 + }); + + ok( hash, "stop event triggered" ); + ok( hash.helper, "UI should not include: helper" ); + ok( hash.placeholder, "UI hash includes: placeholder" ); + ok( hash.position && ( "top" in hash.position && "left" in hash.position ), "UI hash includes: position" ); + ok( hash.offset && ( hash.offset.top && hash.offset.left ), "UI hash includes: offset" ); + ok( hash.item, "UI hash includes: item" ); + ok( hash.sender, "UI hash does not include: sender" ); + equal( overCount, 1, "over fires only once" ); +}); + +/* +test("out", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("activate", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("deactivate", function() { + ok(false, "missing test - untested code is broken code."); +}); +*/ + +})(jQuery); diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_methods.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_methods.js new file mode 100644 index 0000000..07a7bc7 --- /dev/null +++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_methods.js @@ -0,0 +1,92 @@ +/* + * sortable_methods.js + */ +(function($) { + +module("sortable: methods"); + +test("init", function() { + expect(5); + + $("
      ").appendTo("body").sortable().remove(); + ok(true, ".sortable() called on element"); + + $([]).sortable(); + ok(true, ".sortable() called on empty collection"); + + $("
      ").sortable(); + ok(true, ".sortable() called on disconnected DOMElement"); + + $("
      ").sortable().sortable("option", "foo"); + ok(true, "arbitrary option getter after init"); + + $("
      ").sortable().sortable("option", "foo", "bar"); + ok(true, "arbitrary option setter after init"); +}); + +test("destroy", function() { + expect(4); + $("
      ").appendTo("body").sortable().sortable("destroy").remove(); + ok(true, ".sortable('destroy') called on element"); + + $([]).sortable().sortable("destroy"); + ok(true, ".sortable('destroy') called on empty collection"); + + $("
      ").sortable().sortable("destroy"); + ok(true, ".sortable('destroy') called on disconnected DOMElement"); + + var expected = $("
      ").sortable(), + actual = expected.sortable("destroy"); + equal(actual, expected, "destroy is chainable"); +}); + +test("enable", function() { + expect(5); + + var el, actual, expected; + + el = $("#sortable").sortable({ disabled: true }); + + TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, ".sortable({ disabled: true })"); + + el.sortable("enable"); + equal(el.sortable("option", "disabled"), false, "disabled option getter"); + + el.sortable("destroy"); + el.sortable({ disabled: true }); + el.sortable("option", "disabled", false); + equal(el.sortable("option", "disabled"), false, "disabled option setter"); + + TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, ".sortable('option', 'disabled', false)"); + + expected = $("
      ").sortable(), + actual = expected.sortable("enable"); + equal(actual, expected, "enable is chainable"); +}); + +test("disable", function() { + expect(7); + + var el, actual, expected; + + el = $("#sortable").sortable({ disabled: false }); + TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, ".sortable({ disabled: false })"); + + el.sortable("disable"); + TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, "disabled.sortable getter"); + + el.sortable("destroy"); + + el.sortable({ disabled: false }); + TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, ".sortable({ disabled: false })"); + el.sortable("option", "disabled", true); + equal(el.sortable("option", "disabled"), true, "disabled option setter"); + ok(el.sortable("widget").is(":not(.ui-state-disabled)"), "sortable element does not get ui-state-disabled since it's an interaction"); + TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, ".sortable('option', 'disabled', true)"); + + expected = $("
      ").sortable(), + actual = expected.sortable("disable"); + equal(actual, expected, "disable is chainable"); +}); + +})(jQuery); diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_options.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_options.js new file mode 100644 index 0000000..f2beb4d --- /dev/null +++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_options.js @@ -0,0 +1,460 @@ +/* + * sortable_options.js + */ +(function($) { + +module("sortable: options"); + +/* +test("{ appendTo: 'parent' }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ appendTo: Selector }", function() { + ok(false, "missing test - untested code is broken code."); +}); +*/ + +test( "{ axis: false }, default", function() { + expect( 2 ); + + var offsetAfter, + element = $( "#sortable" ).sortable({ + axis: false, + change: function() { + offsetAfter = item.offset(); + notEqual( offsetAfter.left, offsetBefore.left, "x axis not constrained when axis: false" ); + notEqual( offsetAfter.top, offsetBefore.top, "y axis not constrained when axis: false" ); + } + }), + item = element.find( "li" ).eq( 0 ), + offsetBefore = item.offset(); + + item.simulate( "drag", { + dx: 50, + dy: 25, + moves: 1 + }); +}); + +test( "{ axis: 'x' }", function() { + expect( 2 ); + + var offsetAfter, + element = $( "#sortable" ).sortable({ + axis: "x", + change: function() { + offsetAfter = item.offset(); + notEqual( offsetAfter.left, offsetBefore.left, "x axis not constrained when axis: x" ); + equal( offsetAfter.top, offsetBefore.top, "y axis constrained when axis: x" ); + } + }), + item = element.find( "li" ).eq( 0 ), + offsetBefore = item.offset(); + + item.simulate( "drag", { + dx: 50, + dy: 25, + moves: 1 + }); +}); + +test( "{ axis: 'y' }", function() { + expect( 2 ); + + var offsetAfter, + element = $( "#sortable" ).sortable({ + axis: "y", + change: function() { + offsetAfter = item.offset(); + equal( offsetAfter.left, offsetBefore.left, "x axis constrained when axis: y" ); + notEqual( offsetAfter.top, offsetBefore.top, "y axis not constrained when axis: y" ); + } + }), + item = element.find( "li" ).eq( 0 ), + offsetBefore = item.offset(); + + item.simulate( "drag", { + dx: 50, + dy: 25, + moves: 1 + }); +}); + +asyncTest( "#7415: Incorrect revert animation with axis: 'y'", function() { + expect( 2 ); + var expectedLeft, + element = $( "#sortable" ).sortable({ + axis: "y", + revert: true, + stop: start, + sort: function() { + expectedLeft = item.css( "left" ); + } + }), + item = element.find( "li" ).eq( 0 ); + + item.simulate( "drag", { + dy: 300, + dx: 50 + }); + + setTimeout(function() { + var top = parseFloat( item.css( "top" ) ); + equal( item.css( "left" ), expectedLeft, "left not animated" ); + ok( top > 0 && top < 300, "top is animated" ); + }, 100 ); +}); + +/* +test("{ cancel: 'input,textarea,button,select,option' }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ cancel: Selector }", function() { + ok(false, "missing test - untested code is broken code."); +}); +*/ + +test( "#8792: issues with floated items in connected lists", function() { + expect( 2 ); + + var element, + changeCount = 0; + + $( "#qunit-fixture" ) + .html( "" ) + .find( "ul" ).css({ "float": "left", width: "100px" }).end() + .find( "li" ).css({ "float": "left", width: "50px", height: "50px" }); + + $( "#qunit-fixture .c" ).sortable({ + connectWith: "#qunit-fixture .c", + change: function() { + changeCount++; + } + }); + + element = $( "#qunit-fixture li:eq(0)" ); + + // move the first li to the right of the second li in the first ul + element.simulate( "drag", { + dx: 55, + moves: 15 + }); + + equal( changeCount, 1, "change fired only once (no jitters) when dragging a floated sortable in it's own container" ); + + // move the first li ( which is now in the second spot ) + // through the first spot in the second ul to the second spot in the second ul + element.simulate( "drag", { + dx: 100, + moves: 15 + }); + + equal( changeCount, 3, "change fired once for each expected change when dragging a floated sortable to a connected container" ); +}); + +test( "#8301: single axis with connected list", function() { + expect( 1 ); + + var element = $( "#sortable" ).sortable({ + axis: "y", + tolerance: "pointer", + connectWith: ".connected" + }); + + $( "" ) + .sortable({ + axis: "y", + tolerance: "pointer", + connectWith: "#sortable", + receive: function() { + ok( true, "connected list received item" ); + } + }) + .insertAfter( element ); + + element.find( "li" ).eq( 0 ).simulate( "drag", { + handle: "corner", + dy: 120, + moves: 1 + }); +}); + +/* +test("{ connectWith: false }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ connectWith: Selector }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ containment: false }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ containment: Element }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ containment: 'document' }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ containment: 'parent' }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ containment: 'window' }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ containment: Selector }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ cursor: 'auto' }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ cursor: 'move' }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ cursorAt: false }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ cursorAt: true }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ delay: 0 }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ delay: 100 }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ distance: 1 }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ distance: 10 }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ dropOnEmpty: true }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ dropOnEmpty: false }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ forcePlaceholderSize: false }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ forcePlaceholderSize: true }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ forceHelperSize: false }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ forceHelperSize: true }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ grid: false }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ grid: [17, 3] }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ grid: [3, 7] }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ handle: false }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ handle: Element }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ handle: Selector }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ helper: 'original' }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ helper: Function }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ items: '> *' }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ items: Selector }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ opacity: false }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ opacity: .37 }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ opacity: 1 }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ placeholder: false }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); +*/ + +test( "{ placeholder: false } img", function() { + expect( 3 ); + + var element = $( "#sortable-images" ).sortable({ + start: function( event, ui ) { + ok( ui.placeholder.attr( "src" ).indexOf( "images/jqueryui_32x32.png" ) > 0, "placeholder img has correct src" ); + equal( ui.placeholder.height(), 32, "placeholder has correct height" ); + equal( ui.placeholder.width(), 32, "placeholder has correct width" ); + } + }); + + element.find( "img" ).eq( 0 ).simulate( "drag", { + dy: 1 + }); +}); + +test( "{ placeholder: String }", function() { + expect( 1 ); + + var element = $( "#sortable" ).sortable({ + placeholder: "test", + start: function( event, ui ) { + ok( ui.placeholder.hasClass( "test" ), "placeholder has class" ); + } + }); + + element.find( "li" ).eq( 0 ).simulate( "drag", { + dy: 1 + }); +}); + +test( "{ placholder: String } tr", function() { + expect( 4 ); + + var originalWidths, + element = $( "#sortable-table tbody" ).sortable({ + placeholder: "test", + start: function( event, ui ) { + var currentWidths = otherRow.children().map(function() { + return $( this ).width(); + }).get(); + ok( ui.placeholder.hasClass( "test" ), "placeholder has class" ); + deepEqual( currentWidths, originalWidths, "table cells maintian size" ); + equal( ui.placeholder.children().length, dragRow.children().length, + "placeholder has correct number of cells" ); + equal( ui.placeholder.children().html(), $( " " ).html(), + "placeholder td has content for forced dimensions" ); + } + }), + rows = element.children( "tr" ), + dragRow = rows.eq( 0 ), + otherRow = rows.eq( 1 ); + + originalWidths = otherRow.children().map(function() { + return $( this ).width(); + }).get(); + dragRow.simulate( "drag", { + dy: 1 + }); +}); + +/* +test("{ revert: false }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ revert: true }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ scroll: true }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ scroll: false }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ scrollSensitivity: 20 }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ scrollSensitivity: 2 }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ scrollSensitivity: 200 }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ scrollSpeed: 20 }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ scrollSpeed: 2 }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ scrollSpeed: 200 }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ scope: 'default' }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ scope: ??? }, unexpected", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ tolerance: 'intersect' }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ tolerance: 'pointer' }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ zIndex: 1000 }, default", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ zIndex: 1 }", function() { + ok(false, "missing test - untested code is broken code."); +}); + +test("{ zIndex: false }", function() { + ok(false, "missing test - untested code is broken code."); +}); +*/ +})(jQuery); diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_test_helpers.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_test_helpers.js new file mode 100644 index 0000000..12e4829 --- /dev/null +++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/sortable/sortable_test_helpers.js @@ -0,0 +1,9 @@ +TestHelpers.sortable = { + sort: function( handle, dx, dy, index, msg ) { + $( handle ).simulate( "drag", { + dx: dx, + dy: dy + }); + equal( $( handle ).parent().children().index( handle ), index, msg ); + } +}; \ No newline at end of file -- cgit v1.2.2