aboutsummaryrefslogtreecommitdiffstats
path: root/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/datepicker/datepicker_methods.js
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/datepicker/datepicker_methods.js
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/datepicker/datepicker_methods.js')
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/datepicker/datepicker_methods.js125
1 files changed, 125 insertions, 0 deletions
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/datepicker/datepicker_methods.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/datepicker/datepicker_methods.js
new file mode 100644
index 0000000..e52e126
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/datepicker/datepicker_methods.js
@@ -0,0 +1,125 @@
+/*
+ * datepicker_methods.js
+ */
+(function($) {
+
+module("datepicker: methods");
+
+test("destroy", function() {
+ expect( 33 );
+ var inl,
+ inp = TestHelpers.datepicker.init("#inp");
+ ok(inp.is(".hasDatepicker"), "Default - marker class set");
+ ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Default - instance present");
+ ok(inp.next().is("#alt"), "Default - button absent");
+ inp.datepicker("destroy");
+ inp = $("#inp");
+ ok(!inp.is(".hasDatepicker"), "Default - marker class cleared");
+ ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Default - instance absent");
+ ok(inp.next().is("#alt"), "Default - button absent");
+ // With button
+ inp= TestHelpers.datepicker.init("#inp", {showOn: "both"});
+ ok(inp.is(".hasDatepicker"), "Button - marker class set");
+ ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Button - instance present");
+ ok(inp.next().text() === "...", "Button - button added");
+ inp.datepicker("destroy");
+ inp = $("#inp");
+ ok(!inp.is(".hasDatepicker"), "Button - marker class cleared");
+ ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Button - instance absent");
+ ok(inp.next().is("#alt"), "Button - button removed");
+ // With append text
+ inp = TestHelpers.datepicker.init("#inp", {appendText: "Testing"});
+ ok(inp.is(".hasDatepicker"), "Append - marker class set");
+ ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Append - instance present");
+ ok(inp.next().text() === "Testing", "Append - append text added");
+ inp.datepicker("destroy");
+ inp = $("#inp");
+ ok(!inp.is(".hasDatepicker"), "Append - marker class cleared");
+ ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Append - instance absent");
+ ok(inp.next().is("#alt"), "Append - append text removed");
+ // With both
+ inp= TestHelpers.datepicker.init("#inp", {showOn: "both", buttonImageOnly: true,
+ buttonImage: "images/calendar.gif", appendText: "Testing"});
+ ok(inp.is(".hasDatepicker"), "Both - marker class set");
+ ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Both - instance present");
+ ok(inp.next()[0].nodeName.toLowerCase() === "img", "Both - button added");
+ ok(inp.next().next().text() === "Testing", "Both - append text added");
+ inp.datepicker("destroy");
+ inp = $("#inp");
+ ok(!inp.is(".hasDatepicker"), "Both - marker class cleared");
+ ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Both - instance absent");
+ ok(inp.next().is("#alt"), "Both - button and append text absent");
+ // Inline
+ inl = TestHelpers.datepicker.init("#inl");
+ ok(inl.is(".hasDatepicker"), "Inline - marker class set");
+ ok(inl.html() !== "", "Inline - datepicker present");
+ ok($.data(inl[0], TestHelpers.datepicker.PROP_NAME), "Inline - instance present");
+ ok(inl.next().length === 0 || inl.next().is("p"), "Inline - button absent");
+ inl.datepicker("destroy");
+ inl = $("#inl");
+ ok(!inl.is(".hasDatepicker"), "Inline - marker class cleared");
+ ok(inl.html() === "", "Inline - datepicker absent");
+ ok(!$.data(inl[0], TestHelpers.datepicker.PROP_NAME), "Inline - instance absent");
+ ok(inl.next().length === 0 || inl.next().is("p"), "Inline - button absent");
+});
+
+test("enableDisable", function() {
+ expect( 33 );
+ var inl, dp,
+ inp = TestHelpers.datepicker.init("#inp");
+ ok(!inp.datepicker("isDisabled"), "Enable/disable - initially marked as enabled");
+ ok(!inp[0].disabled, "Enable/disable - field initially enabled");
+ inp.datepicker("disable");
+ ok(inp.datepicker("isDisabled"), "Enable/disable - now marked as disabled");
+ ok(inp[0].disabled, "Enable/disable - field now disabled");
+ inp.datepicker("enable");
+ ok(!inp.datepicker("isDisabled"), "Enable/disable - now marked as enabled");
+ ok(!inp[0].disabled, "Enable/disable - field now enabled");
+ inp.datepicker("destroy");
+ // With a button
+ inp = TestHelpers.datepicker.init("#inp", {showOn: "button"});
+ ok(!inp.datepicker("isDisabled"), "Enable/disable button - initially marked as enabled");
+ ok(!inp[0].disabled, "Enable/disable button - field initially enabled");
+ ok(!inp.next("button")[0].disabled, "Enable/disable button - button initially enabled");
+ inp.datepicker("disable");
+ ok(inp.datepicker("isDisabled"), "Enable/disable button - now marked as disabled");
+ ok(inp[0].disabled, "Enable/disable button - field now disabled");
+ ok(inp.next("button")[0].disabled, "Enable/disable button - button now disabled");
+ inp.datepicker("enable");
+ ok(!inp.datepicker("isDisabled"), "Enable/disable button - now marked as enabled");
+ ok(!inp[0].disabled, "Enable/disable button - field now enabled");
+ ok(!inp.next("button")[0].disabled, "Enable/disable button - button now enabled");
+ inp.datepicker("destroy");
+ // With an image button
+ inp = TestHelpers.datepicker.init("#inp", {showOn: "button", buttonImageOnly: true,
+ buttonImage: "images/calendar.gif"});
+ ok(!inp.datepicker("isDisabled"), "Enable/disable image - initially marked as enabled");
+ ok(!inp[0].disabled, "Enable/disable image - field initially enabled");
+ ok(parseFloat(inp.next("img").css("opacity")) === 1, "Enable/disable image - image initially enabled");
+ inp.datepicker("disable");
+ ok(inp.datepicker("isDisabled"), "Enable/disable image - now marked as disabled");
+ ok(inp[0].disabled, "Enable/disable image - field now disabled");
+ ok(parseFloat(inp.next("img").css("opacity")) !== 1, "Enable/disable image - image now disabled");
+ inp.datepicker("enable");
+ ok(!inp.datepicker("isDisabled"), "Enable/disable image - now marked as enabled");
+ ok(!inp[0].disabled, "Enable/disable image - field now enabled");
+ ok(parseFloat(inp.next("img").css("opacity")) === 1, "Enable/disable image - image now enabled");
+ inp.datepicker("destroy");
+ // Inline
+ inl = TestHelpers.datepicker.init("#inl", {changeYear: true});
+ dp = $(".ui-datepicker-inline", inl);
+ ok(!inl.datepicker("isDisabled"), "Enable/disable inline - initially marked as enabled");
+ ok(!dp.children().is(".ui-state-disabled"), "Enable/disable inline - not visually disabled initially");
+ ok(!dp.find("select").prop("disabled"), "Enable/disable inline - form element enabled initially");
+ inl.datepicker("disable");
+ ok(inl.datepicker("isDisabled"), "Enable/disable inline - now marked as disabled");
+ ok(dp.children().is(".ui-state-disabled"), "Enable/disable inline - visually disabled");
+ ok(dp.find("select").prop("disabled"), "Enable/disable inline - form element disabled");
+ inl.datepicker("enable");
+ ok(!inl.datepicker("isDisabled"), "Enable/disable inline - now marked as enabled");
+ ok(!dp.children().is(".ui-state-disabled"), "Enable/disable inline - not visiually disabled");
+ ok(!dp.find("select").prop("disabled"), "Enable/disable inline - form element enabled");
+ inl.datepicker("destroy");
+});
+
+})(jQuery);