mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
core tests: a few comments about failing tests, a few fixes for existing tests, mostly messages; primary remaining issue is that both $("area").is(":visible") and $("area").is(":hidden") return true, which is most likely a bug in jQuery core
This commit is contained in:
parent
b9b604936e
commit
09fd7fc1fa
@ -24,22 +24,22 @@
|
||||
<input type="radio" id="visibleAncestor-inputTypeRadio" />
|
||||
<input type="button" id="visibleAncestor-inputTypeButton" />
|
||||
<input type="hidden" id="visibleAncestor-inputTypeHidden" />
|
||||
<button id="visibleAncestor-button"></button>
|
||||
<button id="visibleAncestor-button">x</button>
|
||||
<select id="visibleAncestor-select">
|
||||
<option>option</option>
|
||||
</select>
|
||||
<textarea id="visibleAncestor-textarea"></textarea>
|
||||
<object id="visibleAncestor-object"></object>
|
||||
<textarea id="visibleAncestor-textarea">x</textarea>
|
||||
<object id="visibleAncestor-object">xxx</object>
|
||||
<a href="#" id="visibleAncestor-anchorWithHref">anchor</a>
|
||||
<a id="visibleAncestor-anchorWithoutHref">anchor</a>
|
||||
<map>
|
||||
<area href="#" id="visibleAncestor-areaWithHref" alt="" />
|
||||
<area id="visibleAncestor-areaWithoutHref" alt="" />
|
||||
</map>
|
||||
<span id="visibleAncestor-span"></span>
|
||||
<div id="visibleAncestor-div"></div>
|
||||
<span id="visibleAncestor-spanWithTabindex" tabindex="1"></span>
|
||||
<div id="visibleAncestor-divWithNegativeTabindex" tabindex="-1"></div>
|
||||
<span id="visibleAncestor-span">x</span>
|
||||
<div id="visibleAncestor-div">x</div>
|
||||
<span id="visibleAncestor-spanWithTabindex" tabindex="1">x</span>
|
||||
<div id="visibleAncestor-divWithNegativeTabindex" tabindex="-1">x</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
@ -6,19 +6,19 @@
|
||||
module("core - selectors");
|
||||
|
||||
function isFocusable(selector, msg) {
|
||||
ok($(selector).is(':focusable'), msg);
|
||||
ok($(selector).is(':focusable'), msg + " - selector " + selector + " is focusable");
|
||||
}
|
||||
|
||||
function isNotFocusable(selector, msg) {
|
||||
ok($(selector).length && !$(selector).is(':focusable'), msg);
|
||||
ok($(selector).length && !$(selector).is(':focusable'), msg + " - selector " + selector + " is not focusable");
|
||||
}
|
||||
|
||||
function isTabbable(selector, msg) {
|
||||
ok($(selector).is(':tabbable'), msg);
|
||||
ok($(selector).is(':tabbable'), msg + " - selector " + selector + " is tabbable");
|
||||
}
|
||||
|
||||
function isNotTabbable(selector, msg) {
|
||||
ok($(selector).length && !$(selector).is(':tabbable'), msg);
|
||||
ok($(selector).length && !$(selector).is(':tabbable'), msg + " - selector " + selector + " is not tabbable");
|
||||
}
|
||||
|
||||
test("data", function() {
|
||||
@ -93,6 +93,7 @@ test("focusable - visible, enabled elements", function() {
|
||||
isFocusable('#visibleAncestor-object', 'object');
|
||||
isFocusable('#visibleAncestor-anchorWithHref', 'anchor with href');
|
||||
isNotFocusable('#visibleAncestor-anchorWithoutHref', 'anchor without href');
|
||||
// fails: $("map").is(":visible") and $("map").is(":hidden") both return true
|
||||
isFocusable('#visibleAncestor-areaWithHref', 'area with href');
|
||||
isNotFocusable('#visibleAncestor-areaWithoutHref', 'area without href');
|
||||
isNotFocusable('#visibleAncestor-span', 'span');
|
||||
@ -131,7 +132,7 @@ test("focusable - hidden styles", function() {
|
||||
isNotFocusable('#visibilityHidden-span', 'span with tabindex, visibility: hidden');
|
||||
});
|
||||
|
||||
test("focusable - natively tabbable with various tabindex", function() {
|
||||
test("focusable - natively focusable with various tabindex", function() {
|
||||
expect(4);
|
||||
|
||||
isFocusable('#inputTabindex0', 'input, tabindex 0');
|
||||
@ -140,7 +141,7 @@ test("focusable - natively tabbable with various tabindex", function() {
|
||||
isFocusable('#inputTabindex-50', 'input, tabindex -50');
|
||||
});
|
||||
|
||||
test("focusable - not natively tabbable with various tabindex", function() {
|
||||
test("focusable - not natively focusable with various tabindex", function() {
|
||||
expect(4);
|
||||
|
||||
isFocusable('#spanTabindex0', 'span, tabindex 0');
|
||||
@ -173,6 +174,7 @@ test("tabbable - visible, enabled elements", function() {
|
||||
isTabbable('#visibleAncestor-object', 'object');
|
||||
isTabbable('#visibleAncestor-anchorWithHref', 'anchor with href');
|
||||
isNotTabbable('#visibleAncestor-anchorWithoutHref', 'anchor without href');
|
||||
// fails: $("map").is(":visible") and $("map").is(":hidden") both return true
|
||||
isTabbable('#visibleAncestor-areaWithHref', 'area with href');
|
||||
isNotTabbable('#visibleAncestor-areaWithoutHref', 'area without href');
|
||||
isNotTabbable('#visibleAncestor-span', 'span');
|
||||
@ -201,10 +203,12 @@ test("Tabbable - hidden styles", function() {
|
||||
isNotTabbable('#displayNoneAncestor-input', 'input, display: none parent');
|
||||
isNotTabbable('#displayNoneAncestor-span', 'span with tabindex, display: none parent');
|
||||
|
||||
// fails: element hidden by parent-visibility-hidden is still visible according to :visible
|
||||
isNotTabbable('#visibilityHiddenAncestor-input', 'input, visibility: hidden parent');
|
||||
isNotTabbable('#visibilityHiddenAncestor-span', 'span with tabindex, visibility: hidden parent');
|
||||
|
||||
isNotTabbable('#displayNone-input', 'input, display: none');
|
||||
// fails: element hidden by parent-visibility-hidden is still visible according to :visible
|
||||
isNotTabbable('#visibilityHidden-input', 'input, visibility: hidden');
|
||||
|
||||
isNotTabbable('#displayNone-span', 'span with tabindex, display: none');
|
||||
|
Loading…
Reference in New Issue
Block a user