Skip to content

Commit

Permalink
Merge branch 'master' into selectmenu
Browse files Browse the repository at this point in the history
  • Loading branch information
kborchers committed Mar 19, 2012
2 parents 682a321 + 11b026d commit e38feea
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 16 deletions.
10 changes: 7 additions & 3 deletions tests/unit/accordion/accordion_methods.js
Expand Up @@ -10,15 +10,19 @@ test( "destroy", function() {
});

test( "enable/disable", function() {
expect( 3 );
expect( 4 );
var element = $( "#list1" ).accordion();
accordion_state( element, 1, 0, 0 );
element.accordion( "disable" );
element.accordion( "option", "active", 1 );
// event does nothing
element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "click" );
accordion_state( element, 1, 0, 0 );
element.accordion( "enable" );
// option still works
element.accordion( "option", "active", 1 );
accordion_state( element, 0, 1, 0 );
element.accordion( "enable" );
element.accordion( "option", "active", 2 );
accordion_state( element, 0, 0, 1 );
});

test( "refresh", function() {
Expand Down
1 change: 1 addition & 0 deletions tests/unit/accordion/accordion_options.js
Expand Up @@ -152,6 +152,7 @@ test( "{ event: custom }", function() {

// ensure old event handlers are unbound
element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom1" );
element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom2" );
equal( element.accordion( "option", "active" ), 2 );
accordion_state( element, 0, 0, 1 );

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/accordion/accordion_test_helpers.js
Expand Up @@ -3,7 +3,7 @@ function accordion_state( accordion ) {
var actual = accordion.find( ".ui-accordion-content" ).map(function() {
return $( this ).css( "display" ) === "none" ? 0 : 1;
}).get();
deepEqual( actual, expected );
QUnit.push( QUnit.equiv(actual, expected), actual, expected );
}

function accordion_equalHeights( accordion, min, max ) {
Expand Down
1 change: 1 addition & 0 deletions themes/base/jquery.ui.menu.css
Expand Up @@ -15,6 +15,7 @@
.ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; }

.ui-menu .ui-state-disabled { font-weight: normal; margin: .4em 0 .2em; line-height: 1.5; }
.ui-menu .ui-state-disabled a { cursor: default; }

/* icon support */
.ui-menu-icons { position: relative; }
Expand Down
4 changes: 2 additions & 2 deletions ui/i18n/jquery.ui.datepicker-fi.js
@@ -1,5 +1,5 @@
/* Finnish initialisation for the jQuery UI date picker plugin. */
/* Written by Harri Kilpi� (harrikilpio@gmail.com). */
/* Written by Harri Kilpiö (harrikilpio@gmail.com). */
jQuery(function($){
$.datepicker.regional['fi'] = {
closeText: 'Sulje',
Expand All @@ -10,7 +10,7 @@ jQuery(function($){
'Heinäkuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'],
monthNamesShort: ['Tammi','Helmi','Maalis','Huhti','Touko','Kesä',
'Heinä','Elo','Syys','Loka','Marras','Joulu'],
dayNamesShort: ['Su','Ma','Ti','Ke','To','Pe','Su'],
dayNamesShort: ['Su','Ma','Ti','Ke','To','Pe','La'],
dayNames: ['Sunnuntai','Maanantai','Tiistai','Keskiviikko','Torstai','Perjantai','Lauantai'],
dayNamesMin: ['Su','Ma','Ti','Ke','To','Pe','La'],
weekHeader: 'Vk',
Expand Down
20 changes: 10 additions & 10 deletions ui/jquery.ui.accordion.js
Expand Up @@ -68,8 +68,6 @@ $.widget( "ui.accordion", {

this.headers
.attr( "role", "tab" )
// TODO: use _bind()
.bind( "keydown.accordion", $.proxy( this, "_keydown" ) )
.next()
.attr( "role", "tabpanel" );

Expand Down Expand Up @@ -161,8 +159,7 @@ $.widget( "ui.accordion", {

if ( key === "event" ) {
if ( this.options.event ) {
// TODO: this is incorrect for multiple events (see _setupEvents)
this.headers.unbind( this.options.event + ".accordion", this._eventHandler );
this.headers.unbind( ".accordion" );
}
this._setupEvents( value );
}
Expand Down Expand Up @@ -190,8 +187,7 @@ $.widget( "ui.accordion", {
},

_keydown: function( event ) {
// TODO: remove disabled check when using _bind()
if ( this.options.disabled || event.altKey || event.ctrlKey ) {
if ( event.altKey || event.ctrlKey ) {
return;
}

Expand Down Expand Up @@ -300,11 +296,15 @@ $.widget( "ui.accordion", {
},

_setupEvents: function( event ) {
var events = {
keydown: "_keydown"
};
if ( event ) {
// TODO: use _bind()
this.headers.bind( event.split( " " ).join( ".accordion " ) + ".accordion",
$.proxy( this, "_eventHandler" ) );
$.each( event.split(" "), function( index, eventName ) {
events[ eventName ] = "_eventHandler";
});
}
this._bind( this.headers, events );
},

_eventHandler: function( event ) {
Expand All @@ -324,7 +324,7 @@ $.widget( "ui.accordion", {

event.preventDefault();

if ( options.disabled ||
if (
// click on active header, but not collapsible
( clickedIsActive && !options.collapsible ) ||
// allow canceling activation
Expand Down
3 changes: 3 additions & 0 deletions ui/jquery.ui.menu.js
Expand Up @@ -59,6 +59,9 @@ $.widget( "ui.menu", {
"mousedown .ui-menu-item > a": function( event ) {
event.preventDefault();
},
"click .ui-state-disabled > a": function( event ) {
event.preventDefault();
},
"click .ui-menu-item:has(a)": function( event ) {
event.stopImmediatePropagation();
//Don't select disabled menu items
Expand Down

0 comments on commit e38feea

Please sign in to comment.