diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-06-08 17:02:57 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-06-08 17:02:57 -0400 |
commit | da84672db8ad1f3909e645a665e9a9c6c0de0ded (patch) | |
tree | bf6261b0059b0bd716ec6df9196c01c38c02216b /tests | |
parent | 7cd3d0a99ec4c92671aa637d322a41300786d879 (diff) | |
download | jquery-ui-da84672db8ad1f3909e645a665e9a9c6c0de0ded.tar.gz jquery-ui-da84672db8ad1f3909e645a665e9a9c6c0de0ded.zip |
.attr() -> .prop()
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/accordion/accordion_core.js | 16 | ||||
-rw-r--r-- | tests/unit/button/button_options.js | 12 | ||||
-rw-r--r-- | tests/unit/core/core.html | 8 | ||||
-rw-r--r-- | tests/unit/core/selector.js | 18 | ||||
-rw-r--r-- | tests/unit/datepicker/datepicker_methods.js | 6 | ||||
-rw-r--r-- | tests/unit/datepicker/datepicker_options.js | 35 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_tickets.js | 8 | ||||
-rw-r--r-- | tests/unit/progressbar/progressbar_core.js | 4 | ||||
-rw-r--r-- | tests/unit/testsuite.js | 2 | ||||
-rw-r--r-- | tests/unit/tooltip/tooltip_methods.js | 2 |
10 files changed, 40 insertions, 71 deletions
diff --git a/tests/unit/accordion/accordion_core.js b/tests/unit/accordion/accordion_core.js index 280339c26..7bf71c31b 100644 --- a/tests/unit/accordion/accordion_core.js +++ b/tests/unit/accordion/accordion_core.js @@ -39,15 +39,15 @@ test( "accessibility", function () { equals( element.attr( "role" ), "tablist", "main role" ); equals( headers.attr( "role" ), "tab", "tab roles" ); equals( headers.next().attr( "role" ), "tabpanel", "tabpanel roles" ); - equals( headers.eq( 1 ).attr( "aria-expanded" ), "true", "active tab has aria-expanded" ); - equals( headers.eq( 0 ).attr( "aria-expanded" ), "false", "inactive tab has aria-expanded" ); - equals( headers.eq( 1 ).attr( "aria-selected" ), "true", "active tab has aria-selected" ); - equals( headers.eq( 0 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" ); + equals( headers.eq( 1 ).prop( "aria-expanded" ), true, "active tab has aria-expanded" ); + equals( headers.eq( 0 ).prop( "aria-expanded" ), false, "inactive tab has aria-expanded" ); + equals( headers.eq( 1 ).prop( "aria-selected" ), true, "active tab has aria-selected" ); + equals( headers.eq( 0 ).prop( "aria-selected" ), false, "inactive tab has aria-selected" ); element.accordion( "option", "active", 0 ); - equals( headers.eq( 0 ).attr( "aria-expanded" ), "true", "newly active tab has aria-expanded" ); - equals( headers.eq( 1 ).attr( "aria-expanded" ), "false", "newly inactive tab has aria-expanded" ); - equals( headers.eq( 0 ).attr( "aria-selected" ), "true", "active tab has aria-selected" ); - equals( headers.eq( 1 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" ); + equals( headers.eq( 0 ).prop( "aria-expanded" ), true, "newly active tab has aria-expanded" ); + equals( headers.eq( 1 ).prop( "aria-expanded" ), false, "newly inactive tab has aria-expanded" ); + equals( headers.eq( 0 ).prop( "aria-selected" ), true, "active tab has aria-selected" ); + equals( headers.eq( 1 ).prop( "aria-selected" ), false, "inactive tab has aria-selected" ); }); }( jQuery ) ); diff --git a/tests/unit/button/button_options.js b/tests/unit/button/button_options.js index 5b25ecd63..a3ab5ae10 100644 --- a/tests/unit/button/button_options.js +++ b/tests/unit/button/button_options.js @@ -5,28 +5,28 @@ module("button: options"); -test("disabled, explicity value", function() { +test("disabled, explicit value", function() { $("#radio01").button({ disabled: false }); same(false, $("#radio01").button("option", "disabled"), "disabled option set to false"); - same(false, $("#radio01").attr("disabled"), "element is disabled"); + same(false, $("#radio01").prop("disabled"), "element is disabled"); $("#radio02").button({ disabled: true }); same(true, $("#radio02").button("option", "disabled"), "disabled option set to true"); - same(true, $("#radio02").attr("disabled"), "element is not disabled"); + same(true, $("#radio02").prop("disabled"), "element is not disabled"); }); test("disabled, null", function() { $("#radio01").button({ disabled: null }); same(false, $("#radio01").button("option", "disabled"), "disabled option set to false"); - same(false, $("#radio01").attr("disabled"), "element is disabled"); + same(false, $("#radio01").prop("disabled"), "element is disabled"); - $("#radio02").attr("disabled", "disabled").button({ disabled: null }); + $("#radio02").prop("disabled", true).button({ disabled: null }); same(true, $("#radio02").button("option", "disabled"), "disabled option set to true"); - same(true, $("#radio02").attr("disabled"), "element is not disabled"); + same(true, $("#radio02").prop("disabled"), "element is not disabled"); }); test("text false without icon", function() { diff --git a/tests/unit/core/core.html b/tests/unit/core/core.html index 31702dd4e..62a8b3c86 100644 --- a/tests/unit/core/core.html +++ b/tests/unit/core/core.html @@ -108,14 +108,6 @@ <span id="spanTabindex-50" tabindex="-50">.</span> </div> - <div> - <input id="inputTabindexfoo" tabindex="foo" /> - <input id="inputTabindex3foo" tabindex="3foo" /> - - <span id="spanTabindexfoo" tabindex="foo">.</span> - <span id="spanTabindex3foo" tabindex="3foo">.</span> - </div> - <div id="zIndex100" style="z-index: 100; position: absolute"> <div id="zIndexAutoWithParent">.</div> </div> diff --git a/tests/unit/core/selector.js b/tests/unit/core/selector.js index e7b7f9b6c..44888ad88 100644 --- a/tests/unit/core/selector.js +++ b/tests/unit/core/selector.js @@ -147,15 +147,6 @@ test("focusable - not natively focusable with various tabindex", function() { isFocusable('#spanTabindex-50', 'span, tabindex -50'); }); -test("focusable - invalid tabindex", function() { - expect(4); - - isFocusable('#inputTabindexfoo', 'input, tabindex foo'); - isFocusable('#inputTabindex3foo', 'input, tabindex 3foo'); - isNotFocusable('#spanTabindexfoo', 'span tabindex foo'); - isNotFocusable('#spanTabindex3foo', 'span, tabindex 3foo'); -}); - test("focusable - area elements", function() { isNotFocusable('#areaCoordsNoHref', 'coords but no href'); isFocusable('#areaCoordsHref', 'coords and href'); @@ -233,15 +224,6 @@ test("tabbable - not natively tabbable with various tabindex", function() { isNotTabbable('#spanTabindex-50', 'span, tabindex -50'); }); -test("tabbable - invalid tabindex", function() { - expect(4); - - isTabbable('#inputTabindexfoo', 'input, tabindex foo'); - isTabbable('#inputTabindex3foo', 'input, tabindex 3foo'); - isNotTabbable('#spanTabindexfoo', 'span tabindex foo'); - isNotTabbable('#spanTabindex3foo', 'span, tabindex 3foo'); -}); - test("tabbable - area elements", function() { isNotTabbable('#areaCoordsNoHref', 'coords but no href'); isTabbable('#areaCoordsHref', 'coords and href'); diff --git a/tests/unit/datepicker/datepicker_methods.js b/tests/unit/datepicker/datepicker_methods.js index 7ef977604..c8f1b75b2 100644 --- a/tests/unit/datepicker/datepicker_methods.js +++ b/tests/unit/datepicker/datepicker_methods.js @@ -106,15 +106,15 @@ test('enableDisable', function() { var dp = $('.ui-datepicker-inline', inl); ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - initially marked as enabled'); ok(!dp.children().is('.ui-state-disabled'), 'Enable/disable inline - not visually disabled initially'); - ok(!dp.find('select').attr('disabled'), 'Enable/disable inline - form element enabled initially'); + ok(!dp.find('select').prop('disabled'), 'Enable/disable inline - form element enabled initially'); inl.datepicker('disable'); ok(inl.datepicker('isDisabled'), 'Enable/disable inline - now marked as disabled'); ok(dp.children().is('.ui-state-disabled'), 'Enable/disable inline - visually disabled'); - ok(dp.find('select').attr('disabled'), 'Enable/disable inline - form element disabled'); + ok(dp.find('select').prop('disabled'), 'Enable/disable inline - form element disabled'); inl.datepicker('enable'); ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - now marked as enabled'); ok(!dp.children().is('.ui-state-disabled'), 'Enable/disable inline - not visiually disabled'); - ok(!dp.find('select').attr('disabled'), 'Enable/disable inline - form element enabled'); + ok(!dp.find('select').prop('disabled'), 'Enable/disable inline - form element enabled'); inl.datepicker('destroy'); }); diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js index a10d1ea45..272af9dac 100644 --- a/tests/unit/datepicker/datepicker_options.js +++ b/tests/unit/datepicker/datepicker_options.js @@ -531,40 +531,37 @@ test('altField', function() { test('autoSize', function() { var inp = init('#inp'); - equals(inp.attr('size'), 20, 'Auto size - default'); + equals(inp.prop('size'), 20, 'Auto size - default'); inp.datepicker('option', 'autoSize', true); - equals(inp.attr('size'), 10, 'Auto size - mm/dd/yy'); + equals(inp.prop('size'), 10, 'Auto size - mm/dd/yy'); inp.datepicker('option', 'dateFormat', 'm/d/yy'); - equals(inp.attr('size'), 10, 'Auto size - m/d/yy'); + equals(inp.prop('size'), 10, 'Auto size - m/d/yy'); inp.datepicker('option', 'dateFormat', 'D M d yy'); - equals(inp.attr('size'), 15, 'Auto size - D M d yy'); + equals(inp.prop('size'), 15, 'Auto size - D M d yy'); inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); - equals(inp.attr('size'), 29, 'Auto size - DD, MM dd, yy'); - inp.removeAttr('size'); + equals(inp.prop('size'), 29, 'Auto size - DD, MM dd, yy'); // French inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional['fr'])); - equals(inp.attr('size'), 20, 'Auto size - fr - default'); + equals(inp.prop('size'), 29, 'Auto size - fr - default'); inp.datepicker('option', 'autoSize', true); - equals(inp.attr('size'), 10, 'Auto size - fr - dd/mm/yy'); + equals(inp.prop('size'), 10, 'Auto size - fr - dd/mm/yy'); inp.datepicker('option', 'dateFormat', 'm/d/yy'); - equals(inp.attr('size'), 10, 'Auto size - fr - m/d/yy'); + equals(inp.prop('size'), 10, 'Auto size - fr - m/d/yy'); inp.datepicker('option', 'dateFormat', 'D M d yy'); - equals(inp.attr('size'), 18, 'Auto size - fr - D M d yy'); + equals(inp.prop('size'), 18, 'Auto size - fr - D M d yy'); inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); - equals(inp.attr('size'), 28, 'Auto size - fr - DD, MM dd, yy'); - inp.removeAttr('size'); + equals(inp.prop('size'), 28, 'Auto size - fr - DD, MM dd, yy'); // Hebrew inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional['he'])); - equals(inp.attr('size'), 20, 'Auto size - he - default'); + equals(inp.prop('size'), 28, 'Auto size - he - default'); inp.datepicker('option', 'autoSize', true); - equals(inp.attr('size'), 10, 'Auto size - he - dd/mm/yy'); + equals(inp.prop('size'), 10, 'Auto size - he - dd/mm/yy'); inp.datepicker('option', 'dateFormat', 'm/d/yy'); - equals(inp.attr('size'), 10, 'Auto size - he - m/d/yy'); + equals(inp.prop('size'), 10, 'Auto size - he - m/d/yy'); inp.datepicker('option', 'dateFormat', 'D M d yy'); - equals(inp.attr('size'), 14, 'Auto size - he - D M d yy'); + equals(inp.prop('size'), 14, 'Auto size - he - D M d yy'); inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); - equals(inp.attr('size'), 23, 'Auto size - he - DD, MM dd, yy'); - inp.removeAttr('size'); + equals(inp.prop('size'), 23, 'Auto size - he - DD, MM dd, yy'); }); test('daylightSaving', function() { @@ -702,7 +699,7 @@ test('callbacks', function() { ok(day21.is('.ui-datepicker-unselectable'), 'Before show day - unselectable 21'); ok(day20.is('.day10'), 'Before show day - CSS 20'); ok(!day21.is('.day10'), 'Before show day - CSS 21'); - ok(day20.attr('title') == '', 'Before show day - title 20'); + ok(!day20.attr('title'), 'Before show day - title 20'); ok(day21.attr('title') == 'Divisble by 3', 'Before show day - title 21'); inp.datepicker('hide').datepicker('destroy'); }); diff --git a/tests/unit/dialog/dialog_tickets.js b/tests/unit/dialog/dialog_tickets.js index def2452de..1cfdcefea 100644 --- a/tests/unit/dialog/dialog_tickets.js +++ b/tests/unit/dialog/dialog_tickets.js @@ -65,17 +65,15 @@ test("#6137: dialog('open') causes form elements to reset on IE7", function() { expect(2); d1 = $('<form><input type="radio" name="radio" id="a" value="a" checked="checked"></input>' + - '<input type="radio" name="radio" id="b" value="b">b</input></form>').dialog({autoOpen: false}); + '<input type="radio" name="radio" id="b" value="b">b</input></form>').appendTo( "body" ).dialog({autoOpen: false}); - d1.find('#b')[0].checked = true; + d1.find('#b').prop( "checked", true ); equal($('input:checked').val(), 'b', "checkbox b is checked"); - d2 = $('<div></div>').dialog({autoOpen: false}); - d1.dialog('open'); equal($('input:checked').val(), 'b', "checkbox b is checked"); - d1.add(d2).remove(); + d1.remove(); }); test("#6645: Missing element not found check in overlay", function(){ diff --git a/tests/unit/progressbar/progressbar_core.js b/tests/unit/progressbar/progressbar_core.js index e59579634..2380061db 100644 --- a/tests/unit/progressbar/progressbar_core.js +++ b/tests/unit/progressbar/progressbar_core.js @@ -19,10 +19,10 @@ test("accessibility", function() { el.progressbar("value", 77); equals(el.attr("aria-valuenow"), 77, "aria-valuenow"); el.progressbar("disable"); - equals(el.attr("aria-disabled"), "true", "aria-disabled on"); + equals(el.prop("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"), $.browser.msie && $.browser.version == 6 || $.browser.version == 7 ? false : "false", "aria-disabled off"); + equals(el.prop("aria-disabled"), false, "aria-disabled off"); }); })(jQuery); diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index 3d9e64d60..c8afcbe79 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -82,7 +82,7 @@ window.domEqual = function( selector, modifier, message ) { var result = {}; result.nodeName = value[0].nodeName; $.each(attributes, function(index, attr) { - result[attr] = value.attr(attr); + result[attr] = value.prop(attr); }); result.children = []; var children = value.children(); diff --git a/tests/unit/tooltip/tooltip_methods.js b/tests/unit/tooltip/tooltip_methods.js index 798d55896..74fd35d84 100644 --- a/tests/unit/tooltip/tooltip_methods.js +++ b/tests/unit/tooltip/tooltip_methods.js @@ -40,7 +40,7 @@ test( "enable/disable", function() { element.tooltip( "disable" ); equal( $( ".ui-tooltip" ).length, 0, "no tooltip when disabled" ); - equal( tooltip.attr( "title" ), "", "title removed on disable" ); + equal( tooltip.attr( "title" ), undefined, "title removed on disable" ); element.tooltip( "open" ); equal( $( ".ui-tooltip" ).length, 0, "open does nothing when disabled" ); |