aboutsummaryrefslogtreecommitdiffstats
path: root/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar
diff options
context:
space:
mode:
Diffstat (limited to '97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar')
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/all.html30
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar.html44
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_common.js12
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_core.js53
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_events.js51
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_methods.js25
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_options.js72
7 files changed, 287 insertions, 0 deletions
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/all.html b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/all.html
new file mode 100644
index 0000000..18ec34c
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/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.9.1.js"></script>
+
+ <link rel="stylesheet" href="../../../external/qunit.css">
+ <link rel="stylesheet" href="../qunit-composite.css">
+ <script src="../../../external/qunit.js"></script>
+ <script src="../qunit-composite.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/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar.html b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar.html
new file mode 100644
index 0000000..70a4abe
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar.html
@@ -0,0 +1,44 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Progressbar Test Suite</title>
+
+ <script src="../../jquery.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>
+ TestHelpers.loadResources({
+ css: [ "ui.core", "ui.progressbar" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.progressbar.js"
+ ]
+ });
+ </script>
+
+ <script src="progressbar_common.js"></script>
+ <script src="progressbar_core.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/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_common.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_common.js
new file mode 100644
index 0000000..0768576
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_common.js
@@ -0,0 +1,12 @@
+TestHelpers.commonWidgetTests( "progressbar", {
+ defaults: {
+ disabled: false,
+ max: 100,
+ value: 0,
+
+ //callbacks
+ change: null,
+ complete: null,
+ create: null
+ }
+});
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_core.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_core.js
new file mode 100644
index 0000000..8f4a138
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_core.js
@@ -0,0 +1,53 @@
+module( "progressbar: core" );
+
+test( "markup structure", function() {
+ expect( 5 );
+ var element = $( "#progressbar" ).progressbar();
+ ok( element.hasClass( "ui-progressbar" ), "main element is .ui-progressbar" );
+ ok( !element.hasClass( "ui-progressbar-indeterminate" ),
+ "main element is not .ui-progressbar-indeterminate" );
+ equal( element.children().length, 1, "main element contains one child" );
+ ok( element.children().eq( 0 ).hasClass( "ui-progressbar-value" ),
+ "child is .ui-progressbar-value" );
+ equal( element.children().children().length, 0, "no overlay div" );
+});
+
+test( "markup structure - indeterminate", function() {
+ expect( 5 );
+ var element = $( "#progressbar" ).progressbar({ value: false });
+ ok( element.hasClass( "ui-progressbar" ), "main element is .ui-progressbar" );
+ ok( element.hasClass( "ui-progressbar-indeterminate" ),
+ "main element is .ui-progressbar-indeterminate" );
+ equal( element.children().length, 1, "main element contains one child" );
+ ok( element.children().eq( 0 ).hasClass( "ui-progressbar-value" ),
+ "child is .ui-progressbar-value" );
+ equal( element.children().children( ".ui-progressbar-overlay" ).length, 1,
+ ".ui-progressbar-value has .ui-progressbar-overlay" );
+});
+
+test( "accessibility", function() {
+ expect( 11 );
+ var element = $( "#progressbar" ).progressbar();
+
+ equal( element.attr( "role" ), "progressbar", "aria role" );
+ equal( element.attr( "aria-valuemin" ), 0, "aria-valuemin" );
+ equal( element.attr( "aria-valuemax" ), 100, "aria-valuemax" );
+ equal( element.attr( "aria-valuenow" ), 0, "aria-valuenow initially" );
+
+ element.progressbar( "value", 77 );
+ equal( element.attr( "aria-valuenow" ), 77, "aria-valuenow" );
+
+ element.progressbar( "option", "max", 150 );
+ equal( element.attr( "aria-valuemax" ), 150, "aria-valuemax" );
+
+ element.progressbar( "disable" );
+ equal( element.attr( "aria-disabled" ), "true", "aria-disabled on" );
+
+ element.progressbar( "enable" );
+ equal( element.attr( "aria-disabled" ), "false", "aria-disabled off" );
+
+ element.progressbar( "option", "value", false );
+ equal( element.attr( "aria-valuemin" ), 0, "aria-valuemin" );
+ equal( element.attr( "aria-valuemax" ), 150, "aria-valuemax" );
+ strictEqual( element.attr( "aria-valuenow" ), undefined, "aria-valuenow" );
+});
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_events.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_events.js
new file mode 100644
index 0000000..95effda
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_events.js
@@ -0,0 +1,51 @@
+module( "progressbar: events" );
+
+test( "create", function() {
+ expect( 1 );
+ $( "#progressbar" ).progressbar({
+ value: 5,
+ create: function() {
+ equal( $( this ).progressbar( "value" ), 5, "Correct value at create" );
+ },
+ change: function() {
+ ok( false, "create has triggered change()" );
+ }
+ });
+});
+
+test( "change", function() {
+ expect( 2 );
+ var element = $( "#progressbar" ).progressbar();
+
+ element.one( "progressbarchange", function() {
+ equal( element.progressbar( "value" ), 5, "change triggered for middle value" );
+ });
+ element.progressbar( "value", 5 );
+ element.one( "progressbarchange", function() {
+ equal( element.progressbar( "value" ), 100, "change triggered for final value" );
+ });
+ element.progressbar( "value", 100 );
+});
+
+test( "complete", function() {
+ expect( 5 );
+ var value,
+ changes = 0,
+ element = $( "#progressbar" ).progressbar({
+ change: function() {
+ changes++;
+ equal( element.progressbar( "value" ), value, "change at " + value );
+ },
+ complete: function() {
+ equal( changes, 3, "complete triggered after change and not on indeterminate" );
+ equal( element.progressbar( "value" ), 100, "value is 100" );
+ }
+ });
+
+ value = 5;
+ element.progressbar( "value", value );
+ value = false;
+ element.progressbar( "value", value );
+ value = 100;
+ element.progressbar( "value", value );
+});
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_methods.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_methods.js
new file mode 100644
index 0000000..cf7faf6
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_methods.js
@@ -0,0 +1,25 @@
+module( "progressbar: methods" );
+
+test( "destroy", function() {
+ expect( 1 );
+ domEqual( "#progressbar", function() {
+ $( "#progressbar" ).progressbar().progressbar( "destroy" );
+ });
+});
+
+test( "value", function() {
+ expect( 3 );
+
+ var element = $( "<div>" ).progressbar({ value: 20 });
+ equal( element.progressbar( "value" ), 20, "correct value as getter" );
+ strictEqual( element.progressbar( "value", 30 ), element, "chainable as setter" );
+ equal( element.progressbar( "option", "value" ), 30, "correct value after setter" );
+});
+
+test( "widget", function() {
+ expect( 2 );
+ var element = $( "#progressbar" ).progressbar(),
+ widgetElement = element.progressbar( "widget" );
+ equal( widgetElement.length, 1, "one element" );
+ strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" );
+});
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_options.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_options.js
new file mode 100644
index 0000000..bc0b5d0
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/progressbar/progressbar_options.js
@@ -0,0 +1,72 @@
+module( "progressbar: options" );
+
+test( "{ value: 0 }, default", function() {
+ expect( 1 );
+ $( "#progressbar" ).progressbar();
+ equal( $( "#progressbar" ).progressbar( "value" ), 0 );
+});
+
+// Ticket #7231 - valueDiv should be hidden when value is at 0%
+test( "value: visibility of valueDiv", function() {
+ expect( 4 );
+ 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" );
+});
+
+test( "{ value: 5 }", function() {
+ expect( 1 );
+ $( "#progressbar" ).progressbar({
+ value: 5
+ });
+ equal( $( "#progressbar" ).progressbar( "value" ), 5 );
+});
+
+test( "{ value: -5 }", function() {
+ expect( 1 );
+ $( "#progressbar" ).progressbar({
+ value: -5
+ });
+ equal( $( "#progressbar" ).progressbar( "value" ), 0,
+ "value constrained at min" );
+});
+
+test( "{ value: 105 }", function() {
+ expect( 1 );
+ $( "#progressbar" ).progressbar({
+ value: 105
+ });
+ equal( $( "#progressbar" ).progressbar( "value" ), 100,
+ "value constrained at max" );
+});
+
+test( "{ value: 10, max: 5 }", function() {
+ expect( 1 );
+ $("#progressbar").progressbar({
+ max: 5,
+ value: 10
+ });
+ equal( $( "#progressbar" ).progressbar( "value" ), 5,
+ "value constrained at max" );
+});
+
+test( "change max below value", function() {
+ expect( 1 );
+ $("#progressbar").progressbar({
+ max: 10,
+ value: 10
+ }).progressbar( "option", "max", 5 );
+ equal( $( "#progressbar" ).progressbar( "value" ), 5,
+ "value constrained at max" );
+});