Merge commit 'd32092c1f0' as 'jquery-ui'

This commit is contained in:
Mark Schouten 2016-08-05 12:47:57 +02:00
commit b23131fdc2
717 changed files with 518330 additions and 0 deletions

View file

@ -0,0 +1,26 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Core Test Suite</title>
<script src="../../../external/jquery/jquery.js"></script>
<link rel="stylesheet" href="../../../external/qunit/qunit.css">
<link rel="stylesheet" href="../../../external/qunit-composite/qunit-composite.css">
<script src="../../../external/qunit/qunit.js"></script>
<script src="../../../external/qunit-composite/qunit-composite.js"></script>
<script src="../subsuite.js"></script>
<script>
testAllVersions( "core" );
</script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">
</div>
</body>
</html>

View file

@ -0,0 +1,214 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Core Test Suite</title>
<script src="../../../external/requirejs/require.js"></script>
<script src="../../lib/css.js"></script>
<script src="../../lib/bootstrap.js" data-modules="core selector"></script>
<style>
.zindex {
z-index: 100;
}
.absolute {
position: absolute;
}
</style>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">
<img src="../../images/jqueryui_32x32.png" usemap="#mymap" width="10" height="10" alt="">
<map name="mymap">
<area shape="rect" coords="1,1,2,2" href="foo.html" id="areaCoordsHref" alt="">
<area href="foo.html" id="areaNoCoordsHref" alt="">
</map>
<map name="mymap2">
<area shape="rect" coords="1,1,2,2" href="foo.html" id="areaNoImg" alt="">
</map>
<form id="formNoTabindex">
<input>
</form>
<form id="formTabindex" tabindex="1">
<input>
</form>
<form>
<fieldset id="enabledFieldset">
<input>
</fieldset>
<fieldset id="disabledFieldset" disabled="disabled">
<input>
</fieldset>
</form>
<div>
<input id="visibleAncestor-inputTypeNone">
<input type="text" id="visibleAncestor-inputTypeText">
<input type="checkbox" id="visibleAncestor-inputTypeCheckbox">
<input type="radio" id="visibleAncestor-inputTypeRadio">
<input type="button" id="visibleAncestor-inputTypeButton" value="visibleAncestor-inputTypeButton">
<input type="hidden" id="visibleAncestor-inputTypeHidden">
<button id="visibleAncestor-button">x</button>
<select id="visibleAncestor-select">
<option>option</option>
</select>
<textarea id="visibleAncestor-textarea">x</textarea>
<object id="visibleAncestor-object" codebase="about:blank">xxx</object>
<a href="#" id="visibleAncestor-anchorWithHref">anchor</a>
<a id="visibleAncestor-anchorWithoutHref">anchor</a>
<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>
<input id="disabledElement-inputTypeNone" disabled="disabled">
<input type="text" id="disabledElement-inputTypeText" disabled="disabled">
<input type="checkbox" id="disabledElement-inputTypeCheckbox" disabled="disabled">
<input type="radio" id="disabledElement-inputTypeRadio" disabled="disabled">
<input type="button" id="disabledElement-inputTypeButton" disabled="disabled" value="disabledElement-inputTypeButton">
<input type="hidden" id="disabledElement-inputTypeHidden" disabled="disabled">
<button id="disabledElement-button" disabled="disabled"></button>
<select id="disabledElement-select" disabled="disabled"></select>
<textarea id="disabledElement-textarea" disabled="disabled"></textarea>
</div>
<div>
<div id="displayNoneAncestor" style="display: none;">
<input id="displayNoneAncestor-input">
<span tabindex="1" id="displayNoneAncestor-span">.</span>
</div>
<div id="visibilityHiddenAncestor" style="visibility: hidden;">
<input id="visibilityHiddenAncestor-input">
<span tabindex="1" id="visibilityHiddenAncestor-span">.</span>
<span id="nestedVisibilityOverrideAncestor" style="visibility: visible;">
<input id="nestedVisibilityOverrideAncestor-input">
<span tabindex="1" id="nestedVisibilityOverrideAncestor-span">.</span>
</span>
<span tabIndex="1" id="nestedVisibilityInheritWithHiddenAncestor"
style="visibility: inherit;">.</span>
<input id="nestedVisibilityInheritWithHiddenAncestor-input" style="visibility: inherit;">
</div>
<div id="visibilityVisibleAncestor" style="visibility: visible;">
<span tabIndex="1" id="nestedVisibilityInheritWithVisibleAncestor"
style="visibility: inherit;">.</span>
<input id="nestedVisibilityInheritWithVisibleAncestor-input" style="visibility: inherit;">
</div>
<span tabindex="1" id="displayNone-span" style="display: none;">.</span>
<span tabindex="1" id="visibilityHidden-span" style="visibility: hidden;">.</span>
<input id="displayNone-input" style="display: none;">
<input id="visibilityHidden-input" style="visibility: hidden;">
</div>
<div>
<input id="inputTabindex0" tabindex="0">
<input id="inputTabindex10" tabindex="10">
<input id="inputTabindex-1" tabindex="-1">
<input id="inputTabindex-50" tabindex="-50">
<span id="spanTabindex0" tabindex="0">.</span>
<span id="spanTabindex10" tabindex="10">.</span>
<span id="spanTabindex-1" tabindex="-1">.</span>
<span id="spanTabindex-50" tabindex="-50">.</span>
</div>
<div style="width: 0; height: 0;">
<input id="dimensionlessParent">
<input id="dimensionlessParent-dimensionless" style="height: 0; width: 0;">
</div>
<div id="dimensions" style="float: left; height: 50px; width: 100px; margin: 1px 12px 11px 2px; border-style: solid; border-width: 3px 14px 13px 4px; padding: 5px 16px 15px 6px;"></div>
<div id="labels-fragment">
<label for="test">1</label>
<div>
<div>
<form>
<label for="test">2</label>
<label>3
<input id="test">
</label>
<label for="test">4</label>
</form>
<label for="test">5</label>
</div>
<div>
<div>
<form>
<label for="test">6</label>
</form>
</div>
</div>
</div>
<div>
<div>
<form>
<label for="test">7</label>
<label>
</label>
<label for="test">8</label>
</form>
<label for="test">9</label>
</div>
<div>
<div>
<form>
<input id="test-2">
<label for="test">10</label>
</form>
</div>
</div>
</div>
</div>
<div id="weird-['x']-id"></div>
</div>
<!-- This is intentionally outside the test fixture. We don't want this
markup to be removed and reinserted between tests, as it will remove saved
refrences in the tests. -->
<div id="form-test">
<input id="body:_implicit_form">
<input id="body:_explicit_form" form="form-1">
<form id="form-1">
<input id="form-1:_implicit_form">
<input id="form-1:_explicit_form" form="form-1">
</form>
<form id="form-2">
<input id="form-2:_implicit_form">
<input id="form-2:_explicit_form_other_form" form="form-1">
</form>
</div>
<div id="form-test-detached">
<input id="fragment:_implicit_form">
<!-- Support: Chrome > 33
When an input with a form attribute is inside a fragment, and not contained by any form,
the form property returns the proper form. However resetting the form does not reset the
input. The following input is commented out to stop the test from failing in this case.
<input id="fragment:_explicit_form" form="form-3">
-->
<form id="form-3">
<input id="form-3:_implicit_form">
<input id="form-3:_explicit_form" form="form-3">
</form>
<form id="form-4">
<input id="form-4:_implicit_form">
<input id="form-4:_explicit_form_other_form" form="form-3">
</form>
</div>
</body>
</html>

208
jquery-ui/tests/unit/core/core.js vendored Normal file
View file

@ -0,0 +1,208 @@
define( [
"qunit",
"jquery",
"lib/common",
"ui/form",
"ui/labels",
"ui/unique-id"
], function( QUnit, $, common ) {
QUnit.module( "core - jQuery extensions" );
common.testJshint( "core" );
QUnit.test( "innerWidth - getter", function( assert ) {
assert.expect( 2 );
var el = $( "#dimensions" );
assert.equal( el.innerWidth(), 122, "getter passthru" );
el.hide();
assert.equal( el.innerWidth(), 122, "getter passthru when hidden" );
} );
QUnit.test( "innerWidth - setter", function( assert ) {
assert.expect( 2 );
var el = $( "#dimensions" );
el.innerWidth( 120 );
assert.equal( el.width(), 98, "width set properly" );
el.hide();
el.innerWidth( 100 );
assert.equal( el.width(), 78, "width set properly when hidden" );
} );
QUnit.test( "innerHeight - getter", function( assert ) {
assert.expect( 2 );
var el = $( "#dimensions" );
assert.equal( el.innerHeight(), 70, "getter passthru" );
el.hide();
assert.equal( el.innerHeight(), 70, "getter passthru when hidden" );
} );
QUnit.test( "innerHeight - setter", function( assert ) {
assert.expect( 2 );
var el = $( "#dimensions" );
el.innerHeight( 60 );
assert.equal( el.height(), 40, "height set properly" );
el.hide();
el.innerHeight( 50 );
assert.equal( el.height(), 30, "height set properly when hidden" );
} );
QUnit.test( "outerWidth - getter", function( assert ) {
assert.expect( 2 );
var el = $( "#dimensions" );
assert.equal( el.outerWidth(), 140, "getter passthru" );
el.hide();
assert.equal( el.outerWidth(), 140, "getter passthru when hidden" );
} );
QUnit.test( "outerWidth - setter", function( assert ) {
assert.expect( 2 );
var el = $( "#dimensions" );
el.outerWidth( 130 );
assert.equal( el.width(), 90, "width set properly" );
el.hide();
el.outerWidth( 120 );
assert.equal( el.width(), 80, "width set properly when hidden" );
} );
QUnit.test( "outerWidth(true) - getter", function( assert ) {
assert.expect( 2 );
var el = $( "#dimensions" );
assert.equal( el.outerWidth( true ), 154, "getter passthru w/ margin" );
el.hide();
assert.equal( el.outerWidth( true ), 154, "getter passthru w/ margin when hidden" );
} );
QUnit.test( "outerWidth(true) - setter", function( assert ) {
assert.expect( 2 );
var el = $( "#dimensions" );
el.outerWidth( 130, true );
assert.equal( el.width(), 76, "width set properly" );
el.hide();
el.outerWidth( 120, true );
assert.equal( el.width(), 66, "width set properly when hidden" );
} );
QUnit.test( "outerHeight - getter", function( assert ) {
assert.expect( 2 );
var el = $( "#dimensions" );
assert.equal( el.outerHeight(), 86, "getter passthru" );
el.hide();
assert.equal( el.outerHeight(), 86, "getter passthru when hidden" );
} );
QUnit.test( "outerHeight - setter", function( assert ) {
assert.expect( 2 );
var el = $( "#dimensions" );
el.outerHeight( 80 );
assert.equal( el.height(), 44, "height set properly" );
el.hide();
el.outerHeight( 70 );
assert.equal( el.height(), 34, "height set properly when hidden" );
} );
QUnit.test( "outerHeight(true) - getter", function( assert ) {
assert.expect( 2 );
var el = $( "#dimensions" );
assert.equal( el.outerHeight( true ), 98, "getter passthru w/ margin" );
el.hide();
assert.equal( el.outerHeight( true ), 98, "getter passthru w/ margin when hidden" );
} );
QUnit.test( "outerHeight(true) - setter", function( assert ) {
assert.expect( 2 );
var el = $( "#dimensions" );
el.outerHeight( 90, true );
assert.equal( el.height(), 42, "height set properly" );
el.hide();
el.outerHeight( 80, true );
assert.equal( el.height(), 32, "height set properly when hidden" );
} );
QUnit.test( "uniqueId / removeUniqueId", function( assert ) {
assert.expect( 3 );
var el = $( "img" ).eq( 0 );
assert.equal( el.attr( "id" ), null, "element has no initial id" );
el.uniqueId();
assert.ok( /ui-id-\d+$/.test( el.attr( "id" ) ), "element has generated id" );
el.removeUniqueId();
assert.equal( el.attr( "id" ), null, "unique id has been removed from element" );
} );
QUnit.test( "Labels", function( assert ) {
assert.expect( 2 );
var expected = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ];
var dom = $( "#labels-fragment" );
function testLabels( testType ) {
var labels = dom.find( "#test" ).labels();
var found = labels.map( function() {
// Support: Core 1.9 Only
// We use $.trim() because core 1.9.x silently fails when white space is present
return $.trim( $( this ).text() );
} ).get();
assert.deepEqual( found, expected,
".labels() finds all labels in " + testType + ", and sorts them in DOM order" );
}
testLabels( "the DOM" );
// Detach the dom to test on a fragment
dom.detach();
testLabels( "document fragments" );
} );
( function() {
var domAttached = $( "#form-test" );
var domDetached = $( "#form-test-detached" ).detach();
function testForm( name, dom ) {
var inputs = dom.find( "input" );
inputs.each( function() {
var input = $( this );
QUnit.test( name + this.id.replace( /_/g, " " ), function( assert ) {
var ready = assert.async();
assert.expect( 1 );
var form = input.form();
// If input has a form the value should reset to "" if not it should be "changed"
var value = form.length ? "" : "changed";
input.val( "changed" );
// If there is a form we reset just that. If there is not a form, reset every form.
// The idea is if a form is found resetting that form should reset the input.
// If no form is found no amount of resetting should change the value.
( form.length ? form : dom.find( "form" ).addBack( "form" ) ).each( function() {
this.reset();
} );
setTimeout( function() {
assert.equal( input.val(), value, "Proper form found for #" + input.attr( "id" ) );
ready();
} );
} );
} );
}
testForm( "form: attached: ", domAttached );
testForm( "form: detached: ", domDetached );
} )();
} );

285
jquery-ui/tests/unit/core/selector.js vendored Normal file
View file

@ -0,0 +1,285 @@
define( [
"qunit",
"jquery",
"ui/data",
"ui/escape-selector",
"ui/focusable",
"ui/tabbable"
], function( QUnit, $ ) {
QUnit.module( "core - selectors" );
QUnit.assert.isFocusable = function( selector, msg ) {
this.push( $( selector ).is( ":focusable" ), null, null,
msg + " - selector " + selector + " is focusable" );
};
QUnit.assert.isNotFocusable = function( selector, msg ) {
this.push( $( selector ).length && !$( selector ).is( ":focusable" ), null, null,
msg + " - selector " + selector + " is not focusable" );
};
QUnit.assert.isTabbable = function( selector, msg ) {
this.push( $( selector ).is( ":tabbable" ), null, null,
msg + " - selector " + selector + " is tabbable" );
};
QUnit.assert.isNotTabbable = function( selector, msg ) {
this.push( $( selector ).length && !$( selector ).is( ":tabbable" ), null, null,
msg + " - selector " + selector + " is not tabbable" );
};
QUnit.test( "data", function( assert ) {
assert.expect( 15 );
var element;
function shouldHaveData( msg ) {
assert.ok( element.is( ":data(test)" ), msg );
}
function shouldNotHaveData( msg ) {
assert.ok( !element.is( ":data(test)" ), msg );
}
element = $( "<div>" );
shouldNotHaveData( "data never set" );
element = $( "<div>" ).data( "test", null );
shouldNotHaveData( "data is null" );
element = $( "<div>" ).data( "test", true );
shouldHaveData( "data set to true" );
element = $( "<div>" ).data( "test", false );
shouldNotHaveData( "data set to false" );
element = $( "<div>" ).data( "test", 0 );
shouldNotHaveData( "data set to 0" );
element = $( "<div>" ).data( "test", 1 );
shouldHaveData( "data set to 1" );
element = $( "<div>" ).data( "test", "" );
shouldNotHaveData( "data set to empty string" );
element = $( "<div>" ).data( "test", "foo" );
shouldHaveData( "data set to string" );
element = $( "<div>" ).data( "test", [] );
shouldHaveData( "data set to empty array" );
element = $( "<div>" ).data( "test", [ 1 ] );
shouldHaveData( "data set to array" );
element = $( "<div>" ).data( "test", {} );
shouldHaveData( "data set to empty object" );
element = $( "<div>" ).data( "test", { foo: "bar" } );
shouldHaveData( "data set to object" );
element = $( "<div>" ).data( "test", new Date() );
shouldHaveData( "data set to date" );
element = $( "<div>" ).data( "test", /test/ );
shouldHaveData( "data set to regexp" );
element = $( "<div>" ).data( "test", function() {} );
shouldHaveData( "data set to function" );
} );
QUnit.test( "focusable - visible, enabled elements", function( assert ) {
assert.expect( 22 );
assert.isNotFocusable( "#formNoTabindex", "form" );
assert.isFocusable( "#formTabindex", "form with tabindex" );
assert.isFocusable( "#enabledFieldset input", "input in enabled fieldset" );
assert.isNotFocusable( "#disabledFieldset input", "input in disabled fieldset" );
assert.isFocusable( "#visibleAncestor-inputTypeNone", "input, no type" );
assert.isFocusable( "#visibleAncestor-inputTypeText", "input, type text" );
assert.isFocusable( "#visibleAncestor-inputTypeCheckbox", "input, type checkbox" );
assert.isFocusable( "#visibleAncestor-inputTypeRadio", "input, type radio" );
assert.isFocusable( "#visibleAncestor-inputTypeButton", "input, type button" );
assert.isNotFocusable( "#visibleAncestor-inputTypeHidden", "input, type hidden" );
assert.isFocusable( "#visibleAncestor-button", "button" );
assert.isFocusable( "#visibleAncestor-select", "select" );
assert.isFocusable( "#visibleAncestor-textarea", "textarea" );
assert.isFocusable( "#visibleAncestor-object", "object" );
assert.isFocusable( "#visibleAncestor-anchorWithHref", "anchor with href" );
assert.isNotFocusable( "#visibleAncestor-anchorWithoutHref", "anchor without href" );
assert.isNotFocusable( "#visibleAncestor-span", "span" );
assert.isNotFocusable( "#visibleAncestor-div", "div" );
assert.isFocusable( "#visibleAncestor-spanWithTabindex", "span with tabindex" );
assert.isFocusable( "#visibleAncestor-divWithNegativeTabindex", "div with tabindex" );
assert.isFocusable( "#nestedVisibilityInheritWithVisibleAncestor",
"span, visibility: inherit inside visibility: visible parent" );
assert.isFocusable( "#nestedVisibilityInheritWithVisibleAncestor-input",
"input, visibility: inherit inside visibility: visible parent" );
} );
QUnit.test( "focusable - disabled elements", function( assert ) {
assert.expect( 9 );
assert.isNotFocusable( "#disabledElement-inputTypeNone", "input, no type" );
assert.isNotFocusable( "#disabledElement-inputTypeText", "input, type text" );
assert.isNotFocusable( "#disabledElement-inputTypeCheckbox", "input, type checkbox" );
assert.isNotFocusable( "#disabledElement-inputTypeRadio", "input, type radio" );
assert.isNotFocusable( "#disabledElement-inputTypeButton", "input, type button" );
assert.isNotFocusable( "#disabledElement-inputTypeHidden", "input, type hidden" );
assert.isNotFocusable( "#disabledElement-button", "button" );
assert.isNotFocusable( "#disabledElement-select", "select" );
assert.isNotFocusable( "#disabledElement-textarea", "textarea" );
} );
QUnit.test( "focusable - hidden styles", function( assert ) {
assert.expect( 12 );
assert.isNotFocusable( "#displayNoneAncestor-input", "input, display: none parent" );
assert.isNotFocusable( "#displayNoneAncestor-span", "span with tabindex, display: none parent" );
assert.isNotFocusable( "#visibilityHiddenAncestor-input", "input, visibility: hidden parent" );
assert.isNotFocusable( "#visibilityHiddenAncestor-span", "span with tabindex, visibility: hidden parent" );
assert.isFocusable( "#nestedVisibilityOverrideAncestor-input", "input, visibility: visible parent but visibility: hidden grandparent" );
assert.isFocusable( "#nestedVisibilityOverrideAncestor-span", "span with tabindex, visibility: visible parent but visibility: hidden grandparent " );
assert.isNotFocusable( "#nestedVisibilityInheritWithHiddenAncestor", "span, visibility: inherit inside visibility: hidden parent" );
assert.isNotFocusable( "#nestedVisibilityInheritWithHiddenAncestor-input", "input, visibility: inherit inside visibility: hidden parent" );
assert.isNotFocusable( "#displayNone-input", "input, display: none" );
assert.isNotFocusable( "#visibilityHidden-input", "input, visibility: hidden" );
assert.isNotFocusable( "#displayNone-span", "span with tabindex, display: none" );
assert.isNotFocusable( "#visibilityHidden-span", "span with tabindex, visibility: hidden" );
} );
QUnit.test( "focusable - natively focusable with various tabindex", function( assert ) {
assert.expect( 4 );
assert.isFocusable( "#inputTabindex0", "input, tabindex 0" );
assert.isFocusable( "#inputTabindex10", "input, tabindex 10" );
assert.isFocusable( "#inputTabindex-1", "input, tabindex -1" );
assert.isFocusable( "#inputTabindex-50", "input, tabindex -50" );
} );
QUnit.test( "focusable - not natively focusable with various tabindex", function( assert ) {
assert.expect( 4 );
assert.isFocusable( "#spanTabindex0", "span, tabindex 0" );
assert.isFocusable( "#spanTabindex10", "span, tabindex 10" );
assert.isFocusable( "#spanTabindex-1", "span, tabindex -1" );
assert.isFocusable( "#spanTabindex-50", "span, tabindex -50" );
} );
QUnit.test( "focusable - area elements", function( assert ) {
assert.expect( 3 );
assert.isFocusable( "#areaCoordsHref", "coords and href" );
assert.isFocusable( "#areaNoCoordsHref", "href but no coords" );
assert.isNotFocusable( "#areaNoImg", "not associated with an image" );
} );
QUnit.test( "focusable - dimensionless parent with overflow", function( assert ) {
assert.expect( 1 );
assert.isFocusable( "#dimensionlessParent", "input" );
} );
QUnit.test( "tabbable - visible, enabled elements", function( assert ) {
assert.expect( 20 );
assert.isNotTabbable( "#formNoTabindex", "form" );
assert.isTabbable( "#formTabindex", "form with tabindex" );
assert.isTabbable( "#enabledFieldset input", "input in enabled fieldset" );
assert.isNotTabbable( "#disabledFieldset input", "input in disabled fieldset" );
assert.isTabbable( "#visibleAncestor-inputTypeNone", "input, no type" );
assert.isTabbable( "#visibleAncestor-inputTypeText", "input, type text" );
assert.isTabbable( "#visibleAncestor-inputTypeCheckbox", "input, type checkbox" );
assert.isTabbable( "#visibleAncestor-inputTypeRadio", "input, type radio" );
assert.isTabbable( "#visibleAncestor-inputTypeButton", "input, type button" );
assert.isNotTabbable( "#visibleAncestor-inputTypeHidden", "input, type hidden" );
assert.isTabbable( "#visibleAncestor-button", "button" );
assert.isTabbable( "#visibleAncestor-select", "select" );
assert.isTabbable( "#visibleAncestor-textarea", "textarea" );
assert.isTabbable( "#visibleAncestor-object", "object" );
assert.isTabbable( "#visibleAncestor-anchorWithHref", "anchor with href" );
assert.isNotTabbable( "#visibleAncestor-anchorWithoutHref", "anchor without href" );
assert.isNotTabbable( "#visibleAncestor-span", "span" );
assert.isNotTabbable( "#visibleAncestor-div", "div" );
assert.isTabbable( "#visibleAncestor-spanWithTabindex", "span with tabindex" );
assert.isNotTabbable( "#visibleAncestor-divWithNegativeTabindex", "div with tabindex" );
} );
QUnit.test( "tabbable - disabled elements", function( assert ) {
assert.expect( 9 );
assert.isNotTabbable( "#disabledElement-inputTypeNone", "input, no type" );
assert.isNotTabbable( "#disabledElement-inputTypeText", "input, type text" );
assert.isNotTabbable( "#disabledElement-inputTypeCheckbox", "input, type checkbox" );
assert.isNotTabbable( "#disabledElement-inputTypeRadio", "input, type radio" );
assert.isNotTabbable( "#disabledElement-inputTypeButton", "input, type button" );
assert.isNotTabbable( "#disabledElement-inputTypeHidden", "input, type hidden" );
assert.isNotTabbable( "#disabledElement-button", "button" );
assert.isNotTabbable( "#disabledElement-select", "select" );
assert.isNotTabbable( "#disabledElement-textarea", "textarea" );
} );
QUnit.test( "tabbable - hidden styles", function( assert ) {
assert.expect( 10 );
assert.isNotTabbable( "#displayNoneAncestor-input", "input, display: none parent" );
assert.isNotTabbable( "#displayNoneAncestor-span", "span with tabindex, display: none parent" );
assert.isNotTabbable( "#visibilityHiddenAncestor-input", "input, visibility: hidden parent" );
assert.isNotTabbable( "#visibilityHiddenAncestor-span", "span with tabindex, visibility: hidden parent" );
assert.isTabbable( "#nestedVisibilityOverrideAncestor-input", "input, visibility: visible parent but visibility: hidden grandparent" );
assert.isTabbable( "#nestedVisibilityOverrideAncestor-span", "span with tabindex, visibility: visible parent but visibility: hidden grandparent " );
assert.isNotTabbable( "#displayNone-input", "input, display: none" );
assert.isNotTabbable( "#visibilityHidden-input", "input, visibility: hidden" );
assert.isNotTabbable( "#displayNone-span", "span with tabindex, display: none" );
assert.isNotTabbable( "#visibilityHidden-span", "span with tabindex, visibility: hidden" );
} );
QUnit.test( "tabbable - natively tabbable with various tabindex", function( assert ) {
assert.expect( 4 );
assert.isTabbable( "#inputTabindex0", "input, tabindex 0" );
assert.isTabbable( "#inputTabindex10", "input, tabindex 10" );
assert.isNotTabbable( "#inputTabindex-1", "input, tabindex -1" );
assert.isNotTabbable( "#inputTabindex-50", "input, tabindex -50" );
} );
QUnit.test( "tabbable - not natively tabbable with various tabindex", function( assert ) {
assert.expect( 4 );
assert.isTabbable( "#spanTabindex0", "span, tabindex 0" );
assert.isTabbable( "#spanTabindex10", "span, tabindex 10" );
assert.isNotTabbable( "#spanTabindex-1", "span, tabindex -1" );
assert.isNotTabbable( "#spanTabindex-50", "span, tabindex -50" );
} );
QUnit.test( "tabbable - area elements", function( assert ) {
assert.expect( 3 );
assert.isTabbable( "#areaCoordsHref", "coords and href" );
assert.isTabbable( "#areaNoCoordsHref", "href but no coords" );
assert.isNotTabbable( "#areaNoImg", "not associated with an image" );
} );
QUnit.test( "tabbable - dimensionless parent with overflow", function( assert ) {
assert.expect( 1 );
assert.isTabbable( "#dimensionlessParent", "input" );
} );
QUnit.test( "escapeSelector", function( assert ) {
assert.expect( 1 );
assert.equal( $( "#" + $.ui.escapeSelector( "weird-['x']-id" ) ).length, 1,
"properly escapes selectors to use as an id" );
} );
} );