Core: Style updates

Ref #14246
Ref gh-1588
This commit is contained in:
Alexander Schmitz 2015-08-21 00:14:57 -04:00
parent c9fbb763ab
commit fe5534b347
5 changed files with 39 additions and 37 deletions

View File

@ -17,7 +17,7 @@ test( "innerWidth - getter", function() {
equal( el.innerWidth(), 122, "getter passthru" ); equal( el.innerWidth(), 122, "getter passthru" );
el.hide(); el.hide();
equal( el.innerWidth(), 122, "getter passthru when hidden" ); equal( el.innerWidth(), 122, "getter passthru when hidden" );
}); } );
test( "innerWidth - setter", function() { test( "innerWidth - setter", function() {
expect( 2 ); expect( 2 );
@ -28,7 +28,7 @@ test( "innerWidth - setter", function() {
el.hide(); el.hide();
el.innerWidth( 100 ); el.innerWidth( 100 );
equal( el.width(), 78, "width set properly when hidden" ); equal( el.width(), 78, "width set properly when hidden" );
}); } );
test( "innerHeight - getter", function() { test( "innerHeight - getter", function() {
expect( 2 ); expect( 2 );
@ -37,7 +37,7 @@ test( "innerHeight - getter", function() {
equal( el.innerHeight(), 70, "getter passthru" ); equal( el.innerHeight(), 70, "getter passthru" );
el.hide(); el.hide();
equal( el.innerHeight(), 70, "getter passthru when hidden" ); equal( el.innerHeight(), 70, "getter passthru when hidden" );
}); } );
test( "innerHeight - setter", function() { test( "innerHeight - setter", function() {
expect( 2 ); expect( 2 );
@ -48,7 +48,7 @@ test( "innerHeight - setter", function() {
el.hide(); el.hide();
el.innerHeight( 50 ); el.innerHeight( 50 );
equal( el.height(), 30, "height set properly when hidden" ); equal( el.height(), 30, "height set properly when hidden" );
}); } );
test( "outerWidth - getter", function() { test( "outerWidth - getter", function() {
expect( 2 ); expect( 2 );
@ -57,7 +57,7 @@ test( "outerWidth - getter", function() {
equal( el.outerWidth(), 140, "getter passthru" ); equal( el.outerWidth(), 140, "getter passthru" );
el.hide(); el.hide();
equal( el.outerWidth(), 140, "getter passthru when hidden" ); equal( el.outerWidth(), 140, "getter passthru when hidden" );
}); } );
test( "outerWidth - setter", function() { test( "outerWidth - setter", function() {
expect( 2 ); expect( 2 );
@ -68,16 +68,16 @@ test( "outerWidth - setter", function() {
el.hide(); el.hide();
el.outerWidth( 120 ); el.outerWidth( 120 );
equal( el.width(), 80, "width set properly when hidden" ); equal( el.width(), 80, "width set properly when hidden" );
}); } );
test( "outerWidth(true) - getter", function() { test( "outerWidth(true) - getter", function() {
expect( 2 ); expect( 2 );
var el = $( "#dimensions" ); var el = $( "#dimensions" );
equal( el.outerWidth(true), 154, "getter passthru w/ margin" ); equal( el.outerWidth( true ), 154, "getter passthru w/ margin" );
el.hide(); el.hide();
equal( el.outerWidth(true), 154, "getter passthru w/ margin when hidden" ); equal( el.outerWidth( true ), 154, "getter passthru w/ margin when hidden" );
}); } );
test( "outerWidth(true) - setter", function() { test( "outerWidth(true) - setter", function() {
expect( 2 ); expect( 2 );
@ -88,7 +88,7 @@ test( "outerWidth(true) - setter", function() {
el.hide(); el.hide();
el.outerWidth( 120, true ); el.outerWidth( 120, true );
equal( el.width(), 66, "width set properly when hidden" ); equal( el.width(), 66, "width set properly when hidden" );
}); } );
test( "outerHeight - getter", function() { test( "outerHeight - getter", function() {
expect( 2 ); expect( 2 );
@ -97,7 +97,7 @@ test( "outerHeight - getter", function() {
equal( el.outerHeight(), 86, "getter passthru" ); equal( el.outerHeight(), 86, "getter passthru" );
el.hide(); el.hide();
equal( el.outerHeight(), 86, "getter passthru when hidden" ); equal( el.outerHeight(), 86, "getter passthru when hidden" );
}); } );
test( "outerHeight - setter", function() { test( "outerHeight - setter", function() {
expect( 2 ); expect( 2 );
@ -108,16 +108,16 @@ test( "outerHeight - setter", function() {
el.hide(); el.hide();
el.outerHeight( 70 ); el.outerHeight( 70 );
equal( el.height(), 34, "height set properly when hidden" ); equal( el.height(), 34, "height set properly when hidden" );
}); } );
test( "outerHeight(true) - getter", function() { test( "outerHeight(true) - getter", function() {
expect( 2 ); expect( 2 );
var el = $( "#dimensions" ); var el = $( "#dimensions" );
equal( el.outerHeight(true), 98, "getter passthru w/ margin" ); equal( el.outerHeight( true ), 98, "getter passthru w/ margin" );
el.hide(); el.hide();
equal( el.outerHeight(true), 98, "getter passthru w/ margin when hidden" ); equal( el.outerHeight( true ), 98, "getter passthru w/ margin when hidden" );
}); } );
test( "outerHeight(true) - setter", function() { test( "outerHeight(true) - setter", function() {
expect( 2 ); expect( 2 );
@ -128,7 +128,7 @@ test( "outerHeight(true) - setter", function() {
el.hide(); el.hide();
el.outerHeight( 80, true ); el.outerHeight( 80, true );
equal( el.height(), 32, "height set properly when hidden" ); equal( el.height(), 32, "height set properly when hidden" );
}); } );
test( "uniqueId / removeUniqueId", function() { test( "uniqueId / removeUniqueId", function() {
expect( 3 ); expect( 3 );
@ -138,7 +138,7 @@ test( "uniqueId / removeUniqueId", function() {
ok( /ui-id-\d+$/.test( el.attr( "id" ) ), "element has generated id" ); ok( /ui-id-\d+$/.test( el.attr( "id" ) ), "element has generated id" );
el.removeUniqueId(); el.removeUniqueId();
equal( el.attr( "id" ), null, "unique id has been removed from element" ); equal( el.attr( "id" ), null, "unique id has been removed from element" );
}); } );
test( "Labels", function() { test( "Labels", function() {
expect( 2 ); expect( 2 );

View File

@ -14,7 +14,7 @@ function isFocusable( selector, msg ) {
} }
function isNotFocusable( selector, msg ) { function isNotFocusable( selector, msg ) {
QUnit.push( $( selector ).length && !$( selector ).is(":focusable"), null, null, QUnit.push( $( selector ).length && !$( selector ).is( ":focusable" ), null, null,
msg + " - selector " + selector + " is not focusable" ); msg + " - selector " + selector + " is not focusable" );
} }
@ -85,7 +85,7 @@ test( "data", function() {
element = $( "<div>" ).data( "test", function() {} ); element = $( "<div>" ).data( "test", function() {} );
shouldHaveData( "data set to function" ); shouldHaveData( "data set to function" );
}); } );
test( "focusable - visible, enabled elements", function() { test( "focusable - visible, enabled elements", function() {
expect( 18 ); expect( 18 );
@ -108,7 +108,7 @@ test( "focusable - visible, enabled elements", function() {
isNotFocusable( "#visibleAncestor-div", "div" ); isNotFocusable( "#visibleAncestor-div", "div" );
isFocusable( "#visibleAncestor-spanWithTabindex", "span with tabindex" ); isFocusable( "#visibleAncestor-spanWithTabindex", "span with tabindex" );
isFocusable( "#visibleAncestor-divWithNegativeTabindex", "div with tabindex" ); isFocusable( "#visibleAncestor-divWithNegativeTabindex", "div with tabindex" );
}); } );
test( "focusable - disabled elements", function() { test( "focusable - disabled elements", function() {
expect( 9 ); expect( 9 );
@ -122,7 +122,7 @@ test( "focusable - disabled elements", function() {
isNotFocusable( "#disabledElement-button", "button" ); isNotFocusable( "#disabledElement-button", "button" );
isNotFocusable( "#disabledElement-select", "select" ); isNotFocusable( "#disabledElement-select", "select" );
isNotFocusable( "#disabledElement-textarea", "textarea" ); isNotFocusable( "#disabledElement-textarea", "textarea" );
}); } );
test( "focusable - hidden styles", function() { test( "focusable - hidden styles", function() {
expect( 8 ); expect( 8 );
@ -138,7 +138,7 @@ test( "focusable - hidden styles", function() {
isNotFocusable( "#displayNone-span", "span with tabindex, display: none" ); isNotFocusable( "#displayNone-span", "span with tabindex, display: none" );
isNotFocusable( "#visibilityHidden-span", "span with tabindex, visibility: hidden" ); isNotFocusable( "#visibilityHidden-span", "span with tabindex, visibility: hidden" );
}); } );
test( "focusable - natively focusable with various tabindex", function() { test( "focusable - natively focusable with various tabindex", function() {
expect( 4 ); expect( 4 );
@ -147,7 +147,7 @@ test( "focusable - natively focusable with various tabindex", function() {
isFocusable( "#inputTabindex10", "input, tabindex 10" ); isFocusable( "#inputTabindex10", "input, tabindex 10" );
isFocusable( "#inputTabindex-1", "input, tabindex -1" ); isFocusable( "#inputTabindex-1", "input, tabindex -1" );
isFocusable( "#inputTabindex-50", "input, tabindex -50" ); isFocusable( "#inputTabindex-50", "input, tabindex -50" );
}); } );
test( "focusable - not natively focusable with various tabindex", function() { test( "focusable - not natively focusable with various tabindex", function() {
expect( 4 ); expect( 4 );
@ -156,7 +156,7 @@ test( "focusable - not natively focusable with various tabindex", function() {
isFocusable( "#spanTabindex10", "span, tabindex 10" ); isFocusable( "#spanTabindex10", "span, tabindex 10" );
isFocusable( "#spanTabindex-1", "span, tabindex -1" ); isFocusable( "#spanTabindex-1", "span, tabindex -1" );
isFocusable( "#spanTabindex-50", "span, tabindex -50" ); isFocusable( "#spanTabindex-50", "span, tabindex -50" );
}); } );
test( "focusable - area elements", function() { test( "focusable - area elements", function() {
expect( 3 ); expect( 3 );
@ -164,13 +164,13 @@ test( "focusable - area elements", function() {
isFocusable( "#areaCoordsHref", "coords and href" ); isFocusable( "#areaCoordsHref", "coords and href" );
isFocusable( "#areaNoCoordsHref", "href but no coords" ); isFocusable( "#areaNoCoordsHref", "href but no coords" );
isNotFocusable( "#areaNoImg", "not associated with an image" ); isNotFocusable( "#areaNoImg", "not associated with an image" );
}); } );
test( "focusable - dimensionless parent with overflow", function() { test( "focusable - dimensionless parent with overflow", function() {
expect( 1 ); expect( 1 );
isFocusable( "#dimensionlessParent", "input" ); isFocusable( "#dimensionlessParent", "input" );
}); } );
test( "tabbable - visible, enabled elements", function() { test( "tabbable - visible, enabled elements", function() {
expect( 18 ); expect( 18 );
@ -193,7 +193,7 @@ test( "tabbable - visible, enabled elements", function() {
isNotTabbable( "#visibleAncestor-div", "div" ); isNotTabbable( "#visibleAncestor-div", "div" );
isTabbable( "#visibleAncestor-spanWithTabindex", "span with tabindex" ); isTabbable( "#visibleAncestor-spanWithTabindex", "span with tabindex" );
isNotTabbable( "#visibleAncestor-divWithNegativeTabindex", "div with tabindex" ); isNotTabbable( "#visibleAncestor-divWithNegativeTabindex", "div with tabindex" );
}); } );
test( "tabbable - disabled elements", function() { test( "tabbable - disabled elements", function() {
expect( 9 ); expect( 9 );
@ -207,7 +207,7 @@ test( "tabbable - disabled elements", function() {
isNotTabbable( "#disabledElement-button", "button" ); isNotTabbable( "#disabledElement-button", "button" );
isNotTabbable( "#disabledElement-select", "select" ); isNotTabbable( "#disabledElement-select", "select" );
isNotTabbable( "#disabledElement-textarea", "textarea" ); isNotTabbable( "#disabledElement-textarea", "textarea" );
}); } );
test( "tabbable - hidden styles", function() { test( "tabbable - hidden styles", function() {
expect( 8 ); expect( 8 );
@ -223,7 +223,7 @@ test( "tabbable - hidden styles", function() {
isNotTabbable( "#displayNone-span", "span with tabindex, display: none" ); isNotTabbable( "#displayNone-span", "span with tabindex, display: none" );
isNotTabbable( "#visibilityHidden-span", "span with tabindex, visibility: hidden" ); isNotTabbable( "#visibilityHidden-span", "span with tabindex, visibility: hidden" );
}); } );
test( "tabbable - natively tabbable with various tabindex", function() { test( "tabbable - natively tabbable with various tabindex", function() {
expect( 4 ); expect( 4 );
@ -232,7 +232,7 @@ test( "tabbable - natively tabbable with various tabindex", function() {
isTabbable( "#inputTabindex10", "input, tabindex 10" ); isTabbable( "#inputTabindex10", "input, tabindex 10" );
isNotTabbable( "#inputTabindex-1", "input, tabindex -1" ); isNotTabbable( "#inputTabindex-1", "input, tabindex -1" );
isNotTabbable( "#inputTabindex-50", "input, tabindex -50" ); isNotTabbable( "#inputTabindex-50", "input, tabindex -50" );
}); } );
test( "tabbable - not natively tabbable with various tabindex", function() { test( "tabbable - not natively tabbable with various tabindex", function() {
expect( 4 ); expect( 4 );
@ -241,7 +241,7 @@ test( "tabbable - not natively tabbable with various tabindex", function() {
isTabbable( "#spanTabindex10", "span, tabindex 10" ); isTabbable( "#spanTabindex10", "span, tabindex 10" );
isNotTabbable( "#spanTabindex-1", "span, tabindex -1" ); isNotTabbable( "#spanTabindex-1", "span, tabindex -1" );
isNotTabbable( "#spanTabindex-50", "span, tabindex -50" ); isNotTabbable( "#spanTabindex-50", "span, tabindex -50" );
}); } );
test( "tabbable - area elements", function() { test( "tabbable - area elements", function() {
expect( 3 ); expect( 3 );
@ -249,13 +249,13 @@ test( "tabbable - area elements", function() {
isTabbable( "#areaCoordsHref", "coords and href" ); isTabbable( "#areaCoordsHref", "coords and href" );
isTabbable( "#areaNoCoordsHref", "href but no coords" ); isTabbable( "#areaNoCoordsHref", "href but no coords" );
isNotTabbable( "#areaNoImg", "not associated with an image" ); isNotTabbable( "#areaNoImg", "not associated with an image" );
}); } );
test( "tabbable - dimensionless parent with overflow", function() { test( "tabbable - dimensionless parent with overflow", function() {
expect( 1 ); expect( 1 );
isTabbable( "#dimensionlessParent", "input" ); isTabbable( "#dimensionlessParent", "input" );
}); } );
test( "escapeSelector", function() { test( "escapeSelector", function() {
expect( 1 ); expect( 1 );

View File

@ -30,7 +30,8 @@ return $.extend( $.expr[ ":" ], {
return !!$.data( elem, dataName ); return !!$.data( elem, dataName );
}; };
} ) : } ) :
// support: jQuery <1.8
// Support: jQuery <1.8
function( elem, i, match ) { function( elem, i, match ) {
return !!$.data( elem, match[ 3 ] ); return !!$.data( elem, match[ 3 ] );
} }

View File

@ -24,7 +24,7 @@
} }
} ( function( $ ) { } ( function( $ ) {
// selectors // Selectors
$.ui.focusable = function( element, hasTabindex ) { $.ui.focusable = function( element, hasTabindex ) {
var map, mapName, img, var map, mapName, img,
nodeName = element.nodeName.toLowerCase(); nodeName = element.nodeName.toLowerCase();
@ -42,7 +42,8 @@ $.ui.focusable = function( element, hasTabindex ) {
"a" === nodeName ? "a" === nodeName ?
element.href || hasTabindex : element.href || hasTabindex :
hasTabindex ) && hasTabindex ) &&
// the element and all of its ancestors must be visible
// The element and all of its ancestors must be visible
visible( element ); visible( element );
}; };

2
ui/jquery-1-7.js vendored
View File

@ -24,7 +24,7 @@
} }
}( function( $ ) { }( function( $ ) {
// support: jQuery 1.7 only // Support: jQuery 1.7 only
// Not a great way to check versions, but since we only support 1.7+ and only // Not a great way to check versions, but since we only support 1.7+ and only
// need to detect <1.8, this is a simple check that should suffice. Checking // need to detect <1.8, this is a simple check that should suffice. Checking
// for "1.7." would be a bit safer, but the version string is 1.7, not 1.7.0 // for "1.7." would be a bit safer, but the version string is 1.7, not 1.7.0