diff options
author | Alvin Li <liweitianux@gmail.com> | 2013-08-22 15:18:58 +0800 |
---|---|---|
committer | Alvin Li <liweitianux@gmail.com> | 2013-08-22 15:18:58 +0800 |
commit | 3f1d09f3b5b86157ccf9f47eef69a065be6153a4 (patch) | |
tree | 84d424db169cea7daff7dc2ed7e045de15ec86eb /97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable | |
parent | 3ef1e03e4273544cce177ce7fa0e0ab75eded990 (diff) | |
download | 97dev-3f1d09f3b5b86157ccf9f47eef69a065be6153a4.tar.bz2 |
* added latest full package of 'jquery-ui' plugin, v1.10.3;
* improved 'thickbox' plugin to use 'jquery-1.9.x';
* upgraded 'SheetDefault.html', 'NewDeleteIndex.html' and other pages
to use 'jquery-1.9.x';
* improved 'IndexDesc.html' to deal with the problem of no related
annotation found;
* 'indicator.tools.get_record()' added param 'number', and updated
the format of return data;
* added 'get_num_record()' and 'get_num_record_std()' to
'indicator.tools';
* improved 'indicator.views.ajax_get_card_data_chart()',
now can get data by 'num' or by 'date';
* improved 'indicator.views.ajax_get_card_data_table()',
to provide the needed data requested from 'detail_card';
* improved js function 'chart_getdata_draw()' in 'SheetDefault.html';
* 'card_chart.js': renamed 'redraw_chart()' to
'detail_chart_getdata_draw()', and updated to get data by type;
* updated 'table' of 'detail_card' in 'SheetDefault.html';
* improved js function 'get_card_data_table()' for providing and
displaying record data in 'detail_card' table.
TODO:
* add/delete/edit record data
Diffstat (limited to '97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable')
7 files changed, 343 insertions, 0 deletions
diff --git a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/all.html b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/all.html new file mode 100644 index 0000000..e517ef3 --- /dev/null +++ b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/all.html @@ -0,0 +1,30 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>jQuery UI Selectable 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( "selectable" ); + </script> +</head> +<body> + +<h1 id="qunit-header">jQuery UI Selectable 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/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable.html b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable.html new file mode 100644 index 0000000..18ffc6e --- /dev/null +++ b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable.html @@ -0,0 +1,51 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>jQuery UI Selectable 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", "ui.selectable" ], + js: [ + "ui/jquery.ui.core.js", + "ui/jquery.ui.widget.js", + "ui/jquery.ui.mouse.js", + "ui/jquery.ui.selectable.js" + ] + }); + </script> + + <script src="selectable_common.js"></script> + <script src="selectable_core.js"></script> + <script src="selectable_events.js"></script> + <script src="selectable_methods.js"></script> + <script src="selectable_options.js"></script> + + <script src="../swarminject.js"></script> +</head> +<body> + +<h1 id="qunit-header">jQuery UI Selectable 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"> + +<ul id="selectable1"> + <li>Item 1</li> + <li>Item 2</li> + <li class="special">Item 3</li> + <li>Item 4</li> + <li>Item 5</li> +</ul> + +</div> +</body> +</html> diff --git a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_common.js b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_common.js new file mode 100644 index 0000000..d00a47b --- /dev/null +++ b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_common.js @@ -0,0 +1,21 @@ +TestHelpers.commonWidgetTests("selectable", { + defaults: { + appendTo: "body", + autoRefresh: true, + cancel: "input,textarea,button,select,option", + delay: 0, + disabled: false, + distance: 0, + filter: "*", + tolerance: "touch", + + // callbacks + create: null, + selected: null, + selecting: null, + start: null, + stop: null, + unselected: null, + unselecting: null + } +}); diff --git a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_core.js b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_core.js new file mode 100644 index 0000000..9953b6c --- /dev/null +++ b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_core.js @@ -0,0 +1,3 @@ +/* + * selectable_core.js + */
\ No newline at end of file diff --git a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_events.js b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_events.js new file mode 100644 index 0000000..ae35fa3 --- /dev/null +++ b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_events.js @@ -0,0 +1,69 @@ +/* + * selectable_events.js + */ +(function( $ ) { + +module("selectable: events"); + +test( "start", function() { + expect( 2 ); + var el = $("#selectable1"); + el.selectable({ + start: function() { + ok( true, "drag fired start callback" ); + equal( this, el[0], "context of callback" ); + } + }); + el.simulate( "drag", { + dx: 20, + dy: 20 + }); +}); + +test( "stop", function() { + expect( 2 ); + var el = $("#selectable1"); + el.selectable({ + start: function() { + ok( true, "drag fired stop callback" ); + equal( this, el[0], "context of callback" ); + } + }); + el.simulate( "drag", { + dx: 20, + dy: 20 + }); +}); + +test( "mousedown: initial position of helper", function() { + expect( 2 ); + + var helperOffset, + element = $( "#selectable1" ).selectable(), + contentToForceScroll = $( "<div>" ).css({ + height: "10000px", + width: "10000px" + }); + + contentToForceScroll.appendTo( "body" ); + $( window ).scrollTop( 100 ).scrollLeft( 100 ); + + element.simulate( "mousedown", { + clientX: 10, + clientY: 10 + }); + + // we do a GTE comparison here because IE7 erroneously subtracts + // 2 pixels from a simulated mousedown for clientX/Y + // Support: IE7 + helperOffset = $( ".ui-selectable-helper" ).offset(); + ok( helperOffset.top >= 99, "Scroll top should be accounted for." ); + ok( helperOffset.left >= 99, "Scroll left should be accounted for." ); + + // Cleanup + element.simulate( "mouseup" ); + contentToForceScroll.remove(); + $( window ).scrollTop( 0 ).scrollLeft( 0 ); +}); + +})( jQuery ); diff --git a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_methods.js b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_methods.js new file mode 100644 index 0000000..72f9bb2 --- /dev/null +++ b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_methods.js @@ -0,0 +1,104 @@ +/* + * selectable_methods.js + */ +(function($) { + +module("selectable: methods"); + +test("init", function() { + expect( 5 ); + + $("<div></div>").appendTo("body").selectable().remove(); + ok(true, ".selectable() called on element"); + + $([]).selectable().remove(); + ok(true, ".selectable() called on empty collection"); + + $("<div></div>").selectable().remove(); + ok(true, ".selectable() called on disconnected DOMElement"); + + var el = $("<div></div>").selectable(); + el.selectable("option", "foo"); + el.remove(); + ok(true, "arbitrary option getter after init"); + + $("<div></div>").selectable().selectable("option", "foo", "bar").remove(); + ok(true, "arbitrary option setter after init"); +}); + +test("destroy", function() { + expect( 4 ); + + $("<div></div>").appendTo("body").selectable().selectable("destroy").remove(); + ok(true, ".selectable('destroy') called on element"); + + $([]).selectable().selectable("destroy").remove(); + ok(true, ".selectable('destroy') called on empty collection"); + + $("<div></div>").selectable().selectable("destroy").remove(); + ok(true, ".selectable('destroy') called on disconnected DOMElement"); + + var expected = $("<div></div>").selectable(), + actual = expected.selectable("destroy"); + equal(actual, expected, "destroy is chainable"); +}); + +test("enable", function() { + expect(3); + var expected, actual, + fired = false, + el = $("#selectable1"); + + el.selectable({ + disabled: true, + start: function() { fired = true; } + }); + el.simulate( "drag", { + dx: 20, + dy: 20 + }); + equal(fired, false, "start fired"); + el.selectable("enable"); + el.simulate( "drag", { + dx: 20, + dy: 20 + }); + equal(fired, true, "start fired"); + el.selectable("destroy"); + + expected = $("<div></div>").selectable(); + actual = expected.selectable("enable"); + equal(actual, expected, "enable is chainable"); +}); + +test("disable", function() { + expect(3); + var expected, actual, + fired = false, + el = $("#selectable1"); + + el.selectable({ + disabled: false, + start: function() { fired = true; } + }); + el.simulate( "drag", { + dx: 20, + dy: 20 + }); + equal(fired, true, "start fired"); + el.selectable("disable"); + fired = false; + + el.simulate( "drag", { + dx: 20, + dy: 20 + }); + equal(fired, false, "start fired"); + el.selectable("destroy"); + + expected = $("<div></div>").selectable(); + actual = expected.selectable("disable"); + equal(actual, expected, "disable is chainable"); +}); + +})(jQuery); diff --git a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_options.js b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_options.js new file mode 100644 index 0000000..973247f --- /dev/null +++ b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/selectable/selectable_options.js @@ -0,0 +1,65 @@ +/* + * selectable_options.js + */ +(function($) { + +module("selectable: options"); + +test("autoRefresh", function() { + expect(3); + + var actual = 0, + el = $("#selectable1"), + sel = $("*", el), + selected = function() { actual += 1; }; + + el = $("#selectable1").selectable({ autoRefresh: false, selected: selected }); + sel.hide(); + el.simulate( "drag", { + dx: 1000, + dy: 1000 + }); + equal(actual, sel.length); + el.selectable("destroy"); + + actual = 0; + sel.show(); + el = $("#selectable1").selectable({ autoRefresh: true, selected: selected }); + sel.hide(); + el.simulate( "drag", { + dx: 1000, + dy: 1000 + }); + equal(actual, 0); + + sel.show(); + $( sel[ 0 ] ).simulate( "drag", { + dx: 1000, + dy: 1000 + }); + equal(actual, sel.length); + + el.selectable("destroy"); + sel.show(); +}); + +test("filter", function() { + expect(2); + + var actual =0, + el = $("#selectable1"), + sel = $("*", el), + selected = function() { actual += 1; }; + + + el = $("#selectable1").selectable({ filter: ".special", selected: selected }); + el.simulate( "drag", { + dx: 1000, + dy: 1000 + }); + ok(sel.length !== 1, "this test assumes more than 1 selectee"); + equal(actual, 1); + el.selectable("destroy"); +}); + +})(jQuery); |