mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tabs: Rename ui-tab class to ui-tabs-tab for consistent prefixes
Fixes #12061 Closes gh-1538 Ref #7053 Ref jquery/api.jqueryui.com#256
This commit is contained in:
parent
1d193c24dc
commit
74ccbc18a4
@ -9,7 +9,7 @@ var state = testHelper.state;
|
|||||||
module( "tabs: core" );
|
module( "tabs: core" );
|
||||||
|
|
||||||
test( "markup structure", function( assert ) {
|
test( "markup structure", function( assert ) {
|
||||||
expect( 17 );
|
expect( 20 );
|
||||||
var element = $( "#tabs1" ).tabs(),
|
var element = $( "#tabs1" ).tabs(),
|
||||||
tabList = element.find( "ul, ol" ),
|
tabList = element.find( "ul, ol" ),
|
||||||
tabs = tabList.find( "li" ),
|
tabs = tabList.find( "li" ),
|
||||||
@ -21,9 +21,15 @@ test( "markup structure", function( assert ) {
|
|||||||
assert.lacksClasses( element, "ui-tabs-collapsible" );
|
assert.lacksClasses( element, "ui-tabs-collapsible" );
|
||||||
assert.hasClasses( tabList, "ui-tabs-nav ui-widget-header" );
|
assert.hasClasses( tabList, "ui-tabs-nav ui-widget-header" );
|
||||||
equal( tabList.length, 1, "The widget contains exactly one tab list" );
|
equal( tabList.length, 1, "The widget contains exactly one tab list" );
|
||||||
|
assert.hasClasses( tabs[ 0 ], "ui-tabs-tab" );
|
||||||
|
assert.hasClasses( tabs[ 1 ], "ui-tabs-tab" );
|
||||||
|
assert.hasClasses( tabs[ 2 ], "ui-tabs-tab" );
|
||||||
|
|
||||||
|
// DEPRECATED
|
||||||
assert.hasClasses( tabs[ 0 ], "ui-tab" );
|
assert.hasClasses( tabs[ 0 ], "ui-tab" );
|
||||||
assert.hasClasses( tabs[ 1 ], "ui-tab" );
|
assert.hasClasses( tabs[ 1 ], "ui-tab" );
|
||||||
assert.hasClasses( tabs[ 2 ], "ui-tab" );
|
assert.hasClasses( tabs[ 2 ], "ui-tab" );
|
||||||
|
|
||||||
equal( tabs.length, 3, "There are exactly three tabs" );
|
equal( tabs.length, 3, "There are exactly three tabs" );
|
||||||
assert.hasClasses( anchors[ 0 ], "ui-tabs-anchor" );
|
assert.hasClasses( anchors[ 0 ], "ui-tabs-anchor" );
|
||||||
assert.hasClasses( anchors[ 1 ], "ui-tabs-anchor" );
|
assert.hasClasses( anchors[ 1 ], "ui-tabs-anchor" );
|
||||||
|
19
ui/tabs.js
19
ui/tabs.js
@ -32,7 +32,7 @@
|
|||||||
}
|
}
|
||||||
}( function( $ ) {
|
}( function( $ ) {
|
||||||
|
|
||||||
return $.widget( "ui.tabs", {
|
$.widget( "ui.tabs", {
|
||||||
version: "@VERSION",
|
version: "@VERSION",
|
||||||
delay: 300,
|
delay: 300,
|
||||||
options: {
|
options: {
|
||||||
@ -417,7 +417,7 @@ return $.widget( "ui.tabs", {
|
|||||||
role: "tab",
|
role: "tab",
|
||||||
tabIndex: -1
|
tabIndex: -1
|
||||||
} );
|
} );
|
||||||
this._addClass( this.tabs, "ui-tab", "ui-state-default" );
|
this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" );
|
||||||
|
|
||||||
this.anchors = this.tabs.map( function() {
|
this.anchors = this.tabs.map( function() {
|
||||||
return $( "a", this )[ 0 ];
|
return $( "a", this )[ 0 ];
|
||||||
@ -880,4 +880,19 @@ return $.widget( "ui.tabs", {
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
// DEPRECATED
|
||||||
|
// TODO: Switch return back to widget declaration at top of file when this is removed
|
||||||
|
if ( $.uiBackCompat !== false ) {
|
||||||
|
|
||||||
|
// Backcompat for ui-tab class (now ui-tabs-tab)
|
||||||
|
$.widget( "ui.tabs", $.ui.tabs, {
|
||||||
|
_processTabs: function() {
|
||||||
|
this._superApply( arguments );
|
||||||
|
this._addClass( this.tabs, "ui-tab" );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $.ui.tabs;
|
||||||
|
|
||||||
} ) );
|
} ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user