diff options
author | Oleg Gaidarenko <markelog@gmail.com> | 2013-04-08 21:33:17 -0400 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2013-04-08 21:41:08 -0400 |
commit | 08e57b1de728510de008acb25f7d75f0a20b78bc (patch) | |
tree | 8721d2df46dbadb8a8a828d829cceccaa6eb8e26 /test | |
parent | 90eb24e58ddbd0b2f1e052b5b47796691a1de86d (diff) | |
download | jquery-08e57b1de728510de008acb25f7d75f0a20b78bc.tar.gz jquery-08e57b1de728510de008acb25f7d75f0a20b78bc.zip |
Adjust the return value of the tabIndex propHook to match the spec. Fixes #13752.
Diffstat (limited to 'test')
-rw-r--r-- | test/index.html | 6 | ||||
-rw-r--r-- | test/unit/attributes.js | 13 |
2 files changed, 15 insertions, 4 deletions
diff --git a/test/index.html b/test/index.html index 14e686034..fa7f2bb8f 100644 --- a/test/index.html +++ b/test/index.html @@ -272,6 +272,12 @@ Z</textarea> <span>...</span><a id="linkWithNoHrefWithNoTabIndex">Eat a burger</a><span>...</span> <span>...</span><a id="linkWithNoHrefWithTabIndex" tabindex="1">Eat some funyuns</a><span>...</span> <span>...</span><a id="linkWithNoHrefWithNegativeTabIndex" tabindex="-1">Eat some funyuns</a><span>...</span> + <input id="inputWithoutTabIndex"/> + <button id="buttonWithoutTabIndex"></button> + <textarea id="textareaWithoutTabIndex"></textarea> + <menu type="popup"> + <menuitem id="menuitemWithoutTabIndex" command="submitbutton" default/> + </menu> </div> <div id="liveHandlerOrder"> diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 2292d7ff5..369a89f70 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -687,11 +687,16 @@ test( "prop(String, Object)", function() { }); test( "prop('tabindex')", function() { - expect( 8 ); + expect( 11 ); + + // inputs without tabIndex attribute + equal( jQuery("#inputWithoutTabIndex").prop("tabindex"), 0, "input without tabindex" ); + equal( jQuery("#buttonWithoutTabIndex").prop("tabindex"), 0, "button without tabindex" ); + equal( jQuery("#textareaWithoutTabIndex").prop("tabindex"), 0, "textarea without tabindex" ); // elements not natively tabbable equal( jQuery("#listWithTabIndex").prop("tabindex"), 5, "not natively tabbable, with tabindex set to 0" ); - equal( jQuery("#divWithNoTabIndex").prop("tabindex"), undefined, "not natively tabbable, no tabindex set" ); + equal( jQuery("#divWithNoTabIndex").prop("tabindex"), -1, "not natively tabbable, no tabindex set" ); // anchor with href equal( jQuery("#linkWithNoTabIndex").prop("tabindex"), 0, "anchor with href, no tabindex set" ); @@ -699,7 +704,7 @@ test( "prop('tabindex')", function() { equal( jQuery("#linkWithNegativeTabIndex").prop("tabindex"), -1, "anchor with href, tabindex set to -1" ); // anchor without href - equal( jQuery("#linkWithNoHrefWithNoTabIndex").prop("tabindex"), undefined, "anchor without href, no tabindex set" ); + equal( jQuery("#linkWithNoHrefWithNoTabIndex").prop("tabindex"), -1, "anchor without href, no tabindex set" ); equal( jQuery("#linkWithNoHrefWithTabIndex").prop("tabindex"), 1, "anchor without href, tabindex set to 2" ); equal( jQuery("#linkWithNoHrefWithNegativeTabIndex").prop("tabindex"), -1, "anchor without href, no tabindex set" ); }); @@ -709,7 +714,7 @@ test( "prop('tabindex', value)", 10, function() { var clone, element = jQuery("#divWithNoTabIndex"); - equal( element.prop("tabindex"), undefined, "start with no tabindex" ); + equal( element.prop("tabindex"), -1, "start with no tabindex" ); // set a positive string element.prop( "tabindex", "1" ); |