mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Merge branch 'selectmenu' of git://github.com/jquery/jquery-ui into selectmenu
This commit is contained in:
commit
041de0716c
@ -80,4 +80,90 @@ test( "allow form submit on enter when menu is not active", function() {
|
|||||||
ok( !event.isDefaultPrevented(), "default action is prevented" );
|
ok( !event.isDefaultPrevented(), "default action is prevented" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
test( "up arrow invokes search - input", function() {
|
||||||
|
arrowsInvokeSearch( "#autocomplete", true, true );
|
||||||
|
});
|
||||||
|
|
||||||
|
test( "down arrow invokes search - input", function() {
|
||||||
|
arrowsInvokeSearch( "#autocomplete", false, true );
|
||||||
|
});
|
||||||
|
|
||||||
|
test( "up arrow invokes search - textarea", function() {
|
||||||
|
arrowsInvokeSearch( "#autocomplete-textarea", true, false );
|
||||||
|
});
|
||||||
|
|
||||||
|
test( "down arrow invokes search - textarea", function() {
|
||||||
|
arrowsInvokeSearch( "#autocomplete-textarea", false, false );
|
||||||
|
});
|
||||||
|
|
||||||
|
test( "up arrow invokes search - contenteditable", function() {
|
||||||
|
arrowsInvokeSearch( "#autocomplete-contenteditable", true, false );
|
||||||
|
});
|
||||||
|
|
||||||
|
test( "down arrow invokes search - contenteditable", function() {
|
||||||
|
arrowsInvokeSearch( "#autocomplete-contenteditable", false, false );
|
||||||
|
});
|
||||||
|
|
||||||
|
test( "up arrow moves focus - input", function() {
|
||||||
|
arrowsMoveFocus( "#autocomplete", true );
|
||||||
|
});
|
||||||
|
|
||||||
|
test( "down arrow moves focus - input", function() {
|
||||||
|
arrowsMoveFocus( "#autocomplete", false );
|
||||||
|
});
|
||||||
|
|
||||||
|
test( "up arrow moves focus - textarea", function() {
|
||||||
|
arrowsMoveFocus( "#autocomplete-textarea", true );
|
||||||
|
});
|
||||||
|
|
||||||
|
test( "down arrow moves focus - textarea", function() {
|
||||||
|
arrowsMoveFocus( "#autocomplete-textarea", false );
|
||||||
|
});
|
||||||
|
|
||||||
|
test( "up arrow moves focus - contenteditable", function() {
|
||||||
|
arrowsMoveFocus( "#autocomplete-contenteditable", true );
|
||||||
|
});
|
||||||
|
|
||||||
|
test( "down arrow moves focus - contenteditable", function() {
|
||||||
|
arrowsMoveFocus( "#autocomplete-contenteditable", false );
|
||||||
|
});
|
||||||
|
|
||||||
|
function arrowsInvokeSearch( id, isKeyUp, shouldMove ) {
|
||||||
|
expect( 1 );
|
||||||
|
|
||||||
|
var didMove = false,
|
||||||
|
element = $( id ).autocomplete({
|
||||||
|
source: [ "a" ],
|
||||||
|
delay: 0,
|
||||||
|
minLength: 0
|
||||||
|
});
|
||||||
|
element.data( "autocomplete" )._move = function() {
|
||||||
|
didMove = true;
|
||||||
|
};
|
||||||
|
element.simulate( "keydown", { keyCode: ( isKeyUp ? $.ui.keyCode.UP : $.ui.keyCode.DOWN ) } );
|
||||||
|
equal( didMove, shouldMove, "respond to arrow" );
|
||||||
|
}
|
||||||
|
|
||||||
|
function arrowsMoveFocus( id, isKeyUp ) {
|
||||||
|
expect( 1 );
|
||||||
|
|
||||||
|
var didMove = false,
|
||||||
|
element = $( id ).autocomplete({
|
||||||
|
source: [ "a" ],
|
||||||
|
delay: 0,
|
||||||
|
minLength: 0
|
||||||
|
});
|
||||||
|
element.data( "autocomplete" )._move = function() {
|
||||||
|
ok( true, "repsond to arrow" );
|
||||||
|
};
|
||||||
|
element.autocomplete( "search" );
|
||||||
|
element.simulate( "keydown", { keyCode: ( isKeyUp ? $.ui.keyCode.UP : $.ui.keyCode.DOWN ) } );
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
}( jQuery ) );
|
}( jQuery ) );
|
||||||
|
@ -177,19 +177,24 @@ test("draggable", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("height", function() {
|
test("height", function() {
|
||||||
expect(3);
|
expect(4);
|
||||||
|
|
||||||
el = $('<div></div>').dialog();
|
el = $('<div></div>').dialog();
|
||||||
equals(dlg().height(), 150, "default height");
|
equals(dlg().outerHeight(), 150, "default height");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ height: 237 });
|
el = $('<div></div>').dialog({ height: 237 });
|
||||||
equals(dlg().height(), 237, "explicit height");
|
equals(dlg().outerHeight(), 237, "explicit height");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $('<div></div>').dialog();
|
el = $('<div></div>').dialog();
|
||||||
el.dialog('option', 'height', 238);
|
el.dialog('option', 'height', 238);
|
||||||
equals(dlg().height(), 238, "explicit height set after init");
|
equals(dlg().outerHeight(), 238, "explicit height set after init");
|
||||||
|
el.remove();
|
||||||
|
|
||||||
|
el = $('<div></div>').css("padding", "20px")
|
||||||
|
.dialog({ height: 240 });
|
||||||
|
equals(dlg().outerHeight(), 240, "explicit height with padding");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
2
themes/base/jquery.ui.button.css
vendored
2
themes/base/jquery.ui.button.css
vendored
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* http://docs.jquery.com/UI/Button#theming
|
* http://docs.jquery.com/UI/Button#theming
|
||||||
*/
|
*/
|
||||||
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
|
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: hidden; *overflow: visible; } /* the overflow property removes extra width in IE */
|
||||||
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
|
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
|
||||||
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
|
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
|
||||||
.ui-button-icons-only { width: 3.4em; }
|
.ui-button-icons-only { width: 3.4em; }
|
||||||
|
26
ui/jquery.ui.autocomplete.js
vendored
26
ui/jquery.ui.autocomplete.js
vendored
@ -58,6 +58,7 @@ $.widget( "ui.autocomplete", {
|
|||||||
suppressKeyPressRepeat,
|
suppressKeyPressRepeat,
|
||||||
suppressInput;
|
suppressInput;
|
||||||
|
|
||||||
|
this.isMultiLine = this.element.is( "textarea,[contenteditable]" );
|
||||||
this.valueMethod = this.element[ this.element.is( "input,textarea" ) ? "val" : "text" ];
|
this.valueMethod = this.element[ this.element.is( "input,textarea" ) ? "val" : "text" ];
|
||||||
|
|
||||||
this.element
|
this.element
|
||||||
@ -92,15 +93,11 @@ $.widget( "ui.autocomplete", {
|
|||||||
break;
|
break;
|
||||||
case keyCode.UP:
|
case keyCode.UP:
|
||||||
suppressKeyPress = true;
|
suppressKeyPress = true;
|
||||||
self._move( "previous", event );
|
self._keyEvent( "previous", event );
|
||||||
// prevent moving cursor to beginning of text field in some browsers
|
|
||||||
event.preventDefault();
|
|
||||||
break;
|
break;
|
||||||
case keyCode.DOWN:
|
case keyCode.DOWN:
|
||||||
suppressKeyPress = true;
|
suppressKeyPress = true;
|
||||||
self._move( "next", event );
|
self._keyEvent( "next", event );
|
||||||
// prevent moving cursor to end of text field in some browsers
|
|
||||||
event.preventDefault();
|
|
||||||
break;
|
break;
|
||||||
case keyCode.ENTER:
|
case keyCode.ENTER:
|
||||||
case keyCode.NUMPAD_ENTER:
|
case keyCode.NUMPAD_ENTER:
|
||||||
@ -151,14 +148,10 @@ $.widget( "ui.autocomplete", {
|
|||||||
self._move( "nextPage", event );
|
self._move( "nextPage", event );
|
||||||
break;
|
break;
|
||||||
case keyCode.UP:
|
case keyCode.UP:
|
||||||
self._move( "previous", event );
|
self._keyEvent( "previous", event );
|
||||||
// prevent moving cursor to beginning of text field in some browsers
|
|
||||||
event.preventDefault();
|
|
||||||
break;
|
break;
|
||||||
case keyCode.DOWN:
|
case keyCode.DOWN:
|
||||||
self._move( "next", event );
|
self._keyEvent( "next", event );
|
||||||
// prevent moving cursor to end of text field in some browsers
|
|
||||||
event.preventDefault();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -495,6 +488,15 @@ $.widget( "ui.autocomplete", {
|
|||||||
|
|
||||||
_value: function( value ) {
|
_value: function( value ) {
|
||||||
return this.valueMethod.apply( this.element, arguments );
|
return this.valueMethod.apply( this.element, arguments );
|
||||||
|
},
|
||||||
|
|
||||||
|
_keyEvent: function( keyEvent, event ) {
|
||||||
|
if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
|
||||||
|
this._move( keyEvent, event );
|
||||||
|
|
||||||
|
// prevents moving cursor to beginning/end of the text field in some browsers
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
2
ui/jquery.ui.dialog.js
vendored
2
ui/jquery.ui.dialog.js
vendored
@ -625,7 +625,7 @@ $.widget("ui.dialog", {
|
|||||||
height: "auto",
|
height: "auto",
|
||||||
width: options.width
|
width: options.width
|
||||||
})
|
})
|
||||||
.height();
|
.outerHeight();
|
||||||
minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
|
minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
|
||||||
|
|
||||||
if ( options.height === "auto" ) {
|
if ( options.height === "auto" ) {
|
||||||
|
8
ui/jquery.ui.menu.js
vendored
8
ui/jquery.ui.menu.js
vendored
@ -29,7 +29,6 @@ $.widget( "ui.menu", {
|
|||||||
},
|
},
|
||||||
_create: function() {
|
_create: function() {
|
||||||
this.activeMenu = this.element;
|
this.activeMenu = this.element;
|
||||||
this.isScrolling = false;
|
|
||||||
this.menuId = this.element.attr( "id" ) || "ui-menu-" + idIncrement++;
|
this.menuId = this.element.attr( "id" ) || "ui-menu-" + idIncrement++;
|
||||||
if ( this.element.find( ".ui-icon" ).length ) {
|
if ( this.element.find( ".ui-icon" ).length ) {
|
||||||
this.element.addClass( "ui-menu-icons" );
|
this.element.addClass( "ui-menu-icons" );
|
||||||
@ -66,13 +65,10 @@ $.widget( "ui.menu", {
|
|||||||
},
|
},
|
||||||
"mouseover .ui-menu-item": function( event ) {
|
"mouseover .ui-menu-item": function( event ) {
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
if ( !this.isScrolling ) {
|
|
||||||
var target = $( event.currentTarget );
|
var target = $( event.currentTarget );
|
||||||
// Remove ui-state-active class from siblings of the newly focused menu item to avoid a jump caused by adjacent elements both having a class with a border
|
// Remove ui-state-active class from siblings of the newly focused menu item to avoid a jump caused by adjacent elements both having a class with a border
|
||||||
target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
|
target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
|
||||||
this.focus( event, target );
|
this.focus( event, target );
|
||||||
}
|
|
||||||
this.isScrolling = false;
|
|
||||||
},
|
},
|
||||||
"mouseleave": "collapseAll",
|
"mouseleave": "collapseAll",
|
||||||
"mouseleave .ui-menu": "collapseAll",
|
"mouseleave .ui-menu": "collapseAll",
|
||||||
@ -86,10 +82,6 @@ $.widget( "ui.menu", {
|
|||||||
this.collapseAll( event );
|
this.collapseAll( event );
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
},
|
|
||||||
scroll: function( event ) {
|
|
||||||
// Keep track of scrolling to prevent mouseover from firing inadvertently when scrolling the menu
|
|
||||||
this.isScrolling = true;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user