From b792bd46ec9b1b55bf2289faedd4ab3614c9319a Mon Sep 17 00:00:00 2001 From: Richard Worth Date: Wed, 7 Jan 2009 03:31:15 +0000 Subject: restructured unit tests folder --- tests/unit/progressbar/progressbar.html | 24 ++++++++++++ tests/unit/progressbar/progressbar.js | 68 +++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 tests/unit/progressbar/progressbar.html create mode 100644 tests/unit/progressbar/progressbar.js (limited to 'tests/unit/progressbar') diff --git a/tests/unit/progressbar/progressbar.html b/tests/unit/progressbar/progressbar.html new file mode 100644 index 000000000..c6d9becfb --- /dev/null +++ b/tests/unit/progressbar/progressbar.html @@ -0,0 +1,24 @@ + + + + jQuery UI Progressbar Test Suite + + + + + + + + + + + + + + +
+
+
+ + + diff --git a/tests/unit/progressbar/progressbar.js b/tests/unit/progressbar/progressbar.js new file mode 100644 index 000000000..087106510 --- /dev/null +++ b/tests/unit/progressbar/progressbar.js @@ -0,0 +1,68 @@ +/* + * progressbar unit tests + */ +(function($) { +// +// Progressbar Test Helper Functions +// + +var defaults = { + disabled: false, + value: 0 +}; + +var el; + +// Progressbar Tests +module("progressbar"); + +test("init", function() { + expect(1); + + $("
").appendTo('body').progressbar().remove(); + ok(true, '.progressbar() called on element'); + +}); + +test("destroy", function() { + expect(1); + + $("
").appendTo('body').progressbar().progressbar("destroy").remove(); + ok(true, '.progressbar("destroy") called on element'); + +}); + +test("defaults", function() { + el = $('
').progressbar(); + $.each(defaults, function(key, val) { + var actual = el.data(key + ".progressbar"), expected = val; + same(actual, expected, key); + }); + el.remove(); +}); + +test("set defaults on init", function() { + el = $("#progressbar").progressbar({ + value: 50 + }); + + equals(el.progressbar("option", "value"), 50, "value"); +}); + +test("accessibility", function() { + expect(7); + el = $("#progressbar").progressbar(); + + equals(el.attr("role"), "progressbar", "aria role"); + equals(el.attr("aria-valuemin"), 0, "aria-valuemin"); + equals(el.attr("aria-valuemax"), 100, "aria-valuemax"); + equals(el.attr("aria-valuenow"), 0, "aria-valuenow initially"); + el.progressbar("value", 77); + equals(el.attr("aria-valuenow"), 77, "aria-valuenow"); + el.progressbar("disable"); + equals(el.attr("aria-disabled"), "true", "aria-disabled"); + el.progressbar("enable"); + equals(el.attr("aria-disabled"), "false", "enabled"); +}); + +})(jQuery); -- cgit v1.2.3