]> source.dussan.org Git - jquery-ui.git/commitdiff
Spinner: Moved ARIA to input and fixed tests.
authorScott González <scott.gonzalez@gmail.com>
Sat, 15 Jan 2011 13:28:13 +0000 (08:28 -0500)
committerScott González <scott.gonzalez@gmail.com>
Sat, 15 Jan 2011 13:28:13 +0000 (08:28 -0500)
tests/unit/spinner/spinner.html
tests/unit/spinner/spinner_core.js
tests/unit/spinner/spinner_defaults.js
ui/jquery.ui.spinner.js

index cac598248f9959e7512e4b6d7cdfea50da0fb99d..ac90dcf6a29754c6127dbd91387eb5de8f3dd77f 100644 (file)
@@ -27,7 +27,7 @@
 <body>\r
 \r
 \r
-<h1 id="qunit-header">jQuery UI Slider Test Suite</h1>\r
+<h1 id="qunit-header">jQuery UI Spinner Test Suite</h1>\r
 <h2 id="qunit-banner"></h2>\r
 <h2 id="qunit-userAgent"></h2>\r
 <ol id="qunit-tests">\r
index 88603708f4d6d6b7bf3f5fbc70e5a75b7ab7c40a..df2243adcedaf9ef1a7335d6b6560525715ca39f 100644 (file)
@@ -150,22 +150,21 @@ test("reading HTML5 attributes", function() {
 });\r
 \r
 test("ARIA attributes", function() {\r
-       var el = $('#spin').spinner({ min: -5, max: 5, value: 2 }),\r
-               wrapper = el.spinner("widget");\r
+       var el = $('#spin').spinner({ min: -5, max: 5, value: 2 });;\r
        \r
-       equals(wrapper.attr('role'), 'spinbutton', 'role');\r
-       equals(wrapper.attr('aria-valuemin'), -5, 'aria-valuemin');\r
-       equals(wrapper.attr('aria-valuemax'), 5, 'aria-valuemax');\r
-       equals(wrapper.attr('aria-valuenow'), 2, 'aria-valuenow');\r
+       equals(el.attr('role'), 'spinbutton', 'role');\r
+       equals(el.attr('aria-valuemin'), -5, 'aria-valuemin');\r
+       equals(el.attr('aria-valuemax'), 5, 'aria-valuemax');\r
+       equals(el.attr('aria-valuenow'), 2, 'aria-valuenow');\r
        \r
        el.spinner('stepUp');\r
        \r
-       equals(wrapper.attr('aria-valuenow'), 3, 'stepUp 1 step changes aria-valuenow');\r
+       equals(el.attr('aria-valuenow'), 3, 'stepUp 1 step changes aria-valuenow');\r
        \r
        el.spinner('option', { min: -10, max: 10 });\r
        \r
-       equals(wrapper.attr('aria-valuemin'), -10, 'min option changed aria-valuemin changes');\r
-       equals(wrapper.attr('aria-valuemax'), 10, 'max option changed aria-valuemax changes');\r
+       equals(el.attr('aria-valuemin'), -10, 'min option changed aria-valuemin changes');\r
+       equals(el.attr('aria-valuemax'), 10, 'max option changed aria-valuemax changes');\r
 });\r
 \r
 })(jQuery);\r
index 2f5d77585e15f14de6871b7811e2410a45b59100..0389ab1695492f730c6c3287575d4b5de735b148 100644 (file)
@@ -8,6 +8,7 @@ var spinner_defaults = {
        max: null,\r
        min: null,\r
        numberformat: null,\r
+       page: 10,\r
        step: null,\r
        value: null\r
 };\r
index 4a50b714439de3c2c6a3eb39f77c03725a7fb1f1..702e549ffdcf40c751fdba8151c984532372e317 100644 (file)
@@ -69,6 +69,7 @@ $.widget('ui.spinner', {
                                });
 
                this.element
+                       .attr( "role", "spinbutton" )
                        .bind('keydown.spinner', function(event) {
                                if (self.options.disabled) {
                                        return;
@@ -198,7 +199,7 @@ $.widget('ui.spinner', {
        },
        
        _uiSpinnerHtml: function() {
-               return '<span role="spinbutton" class="ui-spinner ui-state-default ui-widget ui-widget-content ui-corner-all"></span>';
+               return '<span class="ui-spinner ui-state-default ui-widget ui-widget-content ui-corner-all"></span>';
        },
        
        _buttonHtml: function() {
@@ -324,7 +325,11 @@ $.widget('ui.spinner', {
                this.element
                        .removeClass('ui-spinner-input')
                        .removeAttr('disabled')
-                       .removeAttr('autocomplete');
+                       .removeAttr('autocomplete')
+                       .removeAttr('role')
+                       .removeAttr('aria-valuemin')
+                       .removeAttr('aria-valuemax')
+                       .removeAttr('aria-valuenow');
                this._super( "destroy" );
                this.uiSpinner.replaceWith(this.element);
        },