From: Richard Worth Date: Wed, 4 Feb 2009 04:39:31 +0000 (+0000) Subject: progressbar unit tests: split tests into individual files X-Git-Tag: 1.6~81 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=04b304031193ff08f2aaac61ce65fefef025adea;p=jquery-ui.git progressbar unit tests: split tests into individual files --- diff --git a/tests/unit/progressbar/progressbar.html b/tests/unit/progressbar/progressbar.html index 614c4a0e9..b12ba3f47 100644 --- a/tests/unit/progressbar/progressbar.html +++ b/tests/unit/progressbar/progressbar.html @@ -12,7 +12,12 @@ - + + + + + + diff --git a/tests/unit/progressbar/progressbar.js b/tests/unit/progressbar/progressbar.js deleted file mode 100644 index 087106510..000000000 --- a/tests/unit/progressbar/progressbar.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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); diff --git a/tests/unit/progressbar/progressbar_core.js b/tests/unit/progressbar/progressbar_core.js index b104ffe38..7e1cafbd5 100644 --- a/tests/unit/progressbar/progressbar_core.js +++ b/tests/unit/progressbar/progressbar_core.js @@ -1,12 +1,27 @@ /* * progressbar_core.js */ + +var el; + (function($) { module("progressbar: core"); -test("testname", function() { - ok(false, "missing test - untested code is broken code."); +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); diff --git a/tests/unit/progressbar/progressbar_defaults.js b/tests/unit/progressbar/progressbar_defaults.js index 70934818c..b663708ce 100644 --- a/tests/unit/progressbar/progressbar_defaults.js +++ b/tests/unit/progressbar/progressbar_defaults.js @@ -3,7 +3,8 @@ */ var progressbar_defaults = { - disabled: false + disabled: false, + value: 0 }; commonWidgetTests('progressbar', { defaults: progressbar_defaults }); diff --git a/tests/unit/progressbar/progressbar_events.js b/tests/unit/progressbar/progressbar_events.js index 26f2500ec..6b73e2e8d 100644 --- a/tests/unit/progressbar/progressbar_events.js +++ b/tests/unit/progressbar/progressbar_events.js @@ -5,7 +5,7 @@ module("progressbar: events"); -test("testname", function() { +test("change", function() { ok(false, "missing test - untested code is broken code."); }); diff --git a/tests/unit/progressbar/progressbar_methods.js b/tests/unit/progressbar/progressbar_methods.js index 810d33a11..ece100e02 100644 --- a/tests/unit/progressbar/progressbar_methods.js +++ b/tests/unit/progressbar/progressbar_methods.js @@ -5,8 +5,20 @@ module("progressbar: methods"); -test("testname", function() { - ok(false, "missing test - untested code is broken code."); +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'); + }); })(jQuery); diff --git a/tests/unit/progressbar/progressbar_options.js b/tests/unit/progressbar/progressbar_options.js index 4699a11e4..f6069a5de 100644 --- a/tests/unit/progressbar/progressbar_options.js +++ b/tests/unit/progressbar/progressbar_options.js @@ -5,7 +5,7 @@ module("progressbar: options"); -test("testname", function() { +test("{ value : 0 }, default", function() { ok(false, "missing test - untested code is broken code."); }); diff --git a/tests/unit/progressbar/progressbar_tickets.js b/tests/unit/progressbar/progressbar_tickets.js index 198b0b852..debd62614 100644 --- a/tests/unit/progressbar/progressbar_tickets.js +++ b/tests/unit/progressbar/progressbar_tickets.js @@ -5,8 +5,4 @@ module("progressbar: tickets"); -test("testname", function() { - ok(false, "missing test - untested code is broken code."); -}); - })(jQuery);