equals( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
});
+test( "handle blur: click", function() {
+ expect( 4 );
+ var $menu = $( "#menu1" ).menu({
+ focus: function( event, ui ) {
+ equal( event.originalEvent.type, "click", "focus triggered 'click'" );
+ equal( event.type, "menufocus", "focus event.type is 'menufocus'" );
+
+ },
+ blur: function( event, ui ) {
+ console.log( event, ui );
+ equal( event.originalEvent.type, "click", "blur triggered 'click'" );
+ equal( event.type, "menublur", "blur event.type is 'menublur'" );
+ }
+ });
+
+ $menu.find( "li a:first" ).trigger( "click" );
+ $( "<a/>", { id: "remove"} ).appendTo("body").trigger( "click" );
+
+ $("#remove").remove();
+});
+
})(jQuery);
this._bind( document, {
click: function( event ) {
if ( !$( event.target ).closest( ".ui-menu" ).length ) {
- this.collapseAll();
+ this.collapseAll( event );
}
}
});
var nested,
self = this;
- this.blur();
+ this.blur( event );
if ( this._hasScroll() ) {
var borderTop = parseFloat( $.curCSS( this.element[0], "borderTopWidth", true ) ) || 0,
this.active.children( "a" ).removeClass( "ui-state-focus" );
this.active = null;
+
+ this._trigger( "blur", event, { item: this.active } );
},
_startOpening: function( submenu ) {
.position( position );
},
- collapseAll: function() {
+ collapseAll: function( event ) {
this.element
.find( "ul" )
.hide()
.find( "a.ui-state-active" )
.removeClass( "ui-state-active" );
- this.blur();
+ this.blur( event );
this.activeMenu = this.element;
},
var ui = {
item: this.active
};
- this.collapseAll();
+ this.collapseAll( event );
this._trigger( "select", event, ui );
}
});