From 3909e6d89e01e4cd8777377c63037896bb95aa2f Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Fri, 25 Nov 2011 21:18:19 +0100 Subject: new jq layout --- .../tests/unit/progressbar/all.html | 30 +++++++++++ .../tests/unit/progressbar/progressbar.html | 46 +++++++++++++++++ .../tests/unit/progressbar/progressbar_core.js | 28 ++++++++++ .../tests/unit/progressbar/progressbar_defaults.js | 10 ++++ .../tests/unit/progressbar/progressbar_events.js | 51 +++++++++++++++++++ .../tests/unit/progressbar/progressbar_methods.js | 36 +++++++++++++ .../tests/unit/progressbar/progressbar_options.js | 59 ++++++++++++++++++++++ 7 files changed, 260 insertions(+) create mode 100644 src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/all.html create mode 100644 src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar.html create mode 100644 src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_core.js create mode 100644 src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_defaults.js create mode 100644 src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_events.js create mode 100644 src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_methods.js create mode 100644 src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar/progressbar_options.js (limited to 'src/main/webapp/jquery-ui-1.9pre/tests/unit/progressbar') 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 @@ + + + + + jQuery UI Progressbar Test Suite + + + + + + + + + + + + + +

jQuery UI Progressbar Test Suite

+

+
+

+
    +
    + +
    + + 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 @@ + + + + + jQuery UI Progressbar Test Suite + + + + + + + + + + + + + + + + + + + + +

    jQuery UI Progressbar Test Suite

    +

    +
    +

    +
      +
      + +
      + +
      + + 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); + + $("
      ").appendTo('body').progressbar().remove(); + ok(true, '.progressbar() called on element'); + +}); + +test("destroy", function() { + expect(2); + + $("
      ").appendTo('body').progressbar().progressbar("destroy").remove(); + ok(true, '.progressbar("destroy") called on element'); + + var expected = $('
      ').progressbar(), + actual = expected.progressbar('destroy'); + equals(actual, expected, 'destroy is chainable'); +}); + +test('value', function() { + expect(3); + + var el = $('
      ').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); -- cgit v1.1