diff options
author | Leif Johansson <leifj@sunet.se> | 2011-11-25 21:18:19 +0100 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2011-11-25 21:18:19 +0100 |
commit | 3909e6d89e01e4cd8777377c63037896bb95aa2f (patch) | |
tree | 59679df287c2bee55087fb5afb8d42e7f93a44fb /src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar | |
parent | e5f94e9be5017f627c1ccd8c6306c5cc2e200432 (diff) |
new jq layout
Diffstat (limited to 'src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar')
7 files changed, 260 insertions, 0 deletions
diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/all.html b/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/all.html new file mode 100644 index 0000000..52c1950 --- /dev/null +++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/all.html @@ -0,0 +1,30 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>jQuery UI Progressbar Test Suite</title> + + <script src="../../../jquery-1.7.1.js"></script> + + <link rel="stylesheet" href="../../../external/qunit.css"> + <link rel="stylesheet" href="../subsuiteRunner.css"> + <script src="../../../external/qunit.js"></script> + <script src="../subsuiteRunner.js"></script> + <script src="../subsuite.js"></script> + + <script> + testAllVersions( "progressbar" ); + </script> +</head> +<body> + +<h1 id="qunit-header">jQuery UI Progressbar 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/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar.html b/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar.html new file mode 100644 index 0000000..8b55f5a --- /dev/null +++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar.html @@ -0,0 +1,46 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>jQuery UI Progressbar Test Suite</title> + + <script src="../../jquery.js"></script> + <script src="../../resource_loader.js"></script> + <script> + loadResources({ + css: [ "ui.core", "ui.progressbar" ], + js: [ + "ui/jquery.ui.core.js", + "ui/jquery.ui.widget.js", + "ui/jquery.ui.progressbar.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 src="progressbar_core.js"></script> + <script src="progressbar_defaults.js"></script> + <script src="progressbar_events.js"></script> + <script src="progressbar_methods.js"></script> + <script src="progressbar_options.js"></script> + + <script src="../swarminject.js"></script> +</head> +<body> + +<h1 id="qunit-header">jQuery UI Progressbar 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 id="progressbar"></div> + +</div> +</body> +</html> diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_core.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_core.js new file mode 100644 index 0000000..a499d85 --- /dev/null +++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_core.js @@ -0,0 +1,28 @@ +/* + * progressbar_core.js + */ + +var el; + +(function($) { + +module("progressbar: core"); + +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 on"); + el.progressbar("enable"); + // FAIL: for some reason IE6 and 7 return a boolean false instead of the string + equals(el.attr("aria-disabled"), "false", "aria-disabled off"); +}); + +})(jQuery); diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_defaults.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_defaults.js new file mode 100644 index 0000000..3856e31 --- /dev/null +++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_defaults.js @@ -0,0 +1,10 @@ +commonWidgetTests( "progressbar", { + defaults: { + disabled: false, + value: 0, + max: 100, + + //callbacks + create: null + } +}); diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_events.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_events.js new file mode 100644 index 0000000..585c090 --- /dev/null +++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_events.js @@ -0,0 +1,51 @@ +/* + * progressbar_events.js + */ +(function($) { + +module("progressbar: events"); + +test("create", function() { + expect(1); + $("#progressbar").progressbar({ + value: 5, + create: function() { + same(5, $(this).progressbar("value") ); + }, + change: function() { + ok(false, 'create() has triggered change()'); + } + }) +}); + +test("change", function() { + expect(1); + $("#progressbar").progressbar({ + change: function() { + same( 5, $(this).progressbar("value") ); + } + }).progressbar("value", 5); +}); + +test( "complete", function() { + expect( 3 ); + var changes = 0, + value; + + $( "#progressbar" ).progressbar({ + change: function() { + changes++; + same( $( this ).progressbar( "value" ), value, "change at " + value ); + }, + complete: function() { + equal( changes, 2, "complete triggered after change" ); + } + }); + + value = 5; + $( "#progressbar" ).progressbar( "value", value ); + value = 100; + $( "#progressbar" ).progressbar( "value", value ); +}); + +})(jQuery); diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_methods.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_methods.js new file mode 100644 index 0000000..a48fa3d --- /dev/null +++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_methods.js @@ -0,0 +1,36 @@ +/* + * progressbar_methods.js + */ +(function($) { + +module("progressbar: methods"); + +test("init", function() { + expect(1); + + $("<div></div>").appendTo('body').progressbar().remove(); + ok(true, '.progressbar() called on element'); + +}); + +test("destroy", function() { + expect(2); + + $("<div></div>").appendTo('body').progressbar().progressbar("destroy").remove(); + ok(true, '.progressbar("destroy") called on element'); + + var expected = $('<div></div>').progressbar(), + actual = expected.progressbar('destroy'); + equals(actual, expected, 'destroy is chainable'); +}); + +test('value', function() { + expect(3); + + var el = $('<div></div>').progressbar({ value: 20 }); + equals(el.progressbar('value'), 20, 'correct value as getter'); + equals(el.progressbar('value', 30), el, 'chainable as setter'); + equals(el.progressbar('option', 'value'), 30, 'correct value after setter'); +}); + +})(jQuery); diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_options.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_options.js new file mode 100644 index 0000000..230c939 --- /dev/null +++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_options.js @@ -0,0 +1,59 @@ +/* + * progressbar_options.js + */ +(function($) { + +module("progressbar: options"); + +test("{ value : 0 }, default", function() { + $("#progressbar").progressbar(); + same( 0, $("#progressbar").progressbar("value") ); +}); + +// Ticket #7231 - valueDiv should be hidden when value is at 0% +test( "value: visibility of valueDiv", function() { + expect( 5 ); + var element = $( "#progressbar" ).progressbar({ + value: 0 + }); + ok( element.children( ".ui-progressbar-value" ).is( ":hidden" ), "valueDiv hidden when value is initialized at 0" ); + element.progressbar( "value", 1 ); + ok( element.children( ".ui-progressbar-value" ).is( ":visible" ), "valueDiv visible when value is set to 1" ); + element.progressbar( "value", 100 ); + ok( element.children( ".ui-progressbar-value" ).is( ":visible" ), "valueDiv visible when value is set to 100" ); + element.progressbar( "value", 0 ); + ok( element.children( ".ui-progressbar-value" ).is( ":hidden" ), "valueDiv hidden when value is set to 0" ); + element.progressbar( "value", -1 ); + ok( element.children( ".ui-progressbar-value" ).is( ":hidden" ), "valueDiv hidden when value set to -1 (normalizes to 0)" ); +}); + +test("{ value : 5 }", function() { + $("#progressbar").progressbar({ + value: 5 + }); + same( 5, $("#progressbar").progressbar("value") ); +}); + +test("{ value : -5 }", function() { + $("#progressbar").progressbar({ + value: -5 + }); + same( 0, $("#progressbar").progressbar("value") ); +}); + +test("{ value : 105 }", function() { + $("#progressbar").progressbar({ + value: 105 + }); + same( 100, $("#progressbar").progressbar("value") ); +}); + +test("{ max : 5, value : 10 }", function() { + $("#progressbar").progressbar({ + max: 5, + value: 10 + }); + same( 5, $("#progressbar").progressbar("value") ); +}); + +})(jQuery); |