Skip to content

Commit 1b885ff

Browse files
committed
Merge branch 'master' into datepicker
# Conflicts: # ui/i18n/datepicker-pt.js
2 parents 2b611ba + 74f8a0a commit 1b885ff

30 files changed

+472
-232
lines changed

demos/autocomplete/combobox.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
.autocomplete({
4949
delay: 0,
5050
minLength: 0,
51-
source: $.proxy( this, "_source" )
51+
source: this._source.bind( this )
5252
})
5353
.tooltip({
5454
classes: {

demos/effect/easing.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
canvas.width = width;
3535
canvas.height = height;
3636
var drawHeight = height * 0.8,
37-
cradius = 10;
37+
cradius = 10,
3838
ctx = canvas.getContext( "2d" );
3939
ctx.fillStyle = "black";
4040

tests/lib/bootstrap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ function migrateUrl() {
181181
}
182182
}
183183

184-
// Load the jQuery 1.7 fixes, if necessary
185-
if ( parseFloat( parseUrl().jquery ) === 1.7 ) {
186-
modules.push( "ui/jquery-1-7" );
184+
// Load the jQuery fixes, if necessary
185+
if ( parseFloat( parseUrl().jquery ) < 3 ) {
186+
modules.unshift( "ui/jquery-1-7" );
187187
}
188188

189189
requireTests( modules, noBackCompat );

tests/lib/qunit-assert-domequal.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ domEqual.attributes = [
5959
"title"
6060
];
6161

62+
function camelCase( string ) {
63+
return string.replace( /-([\da-z])/gi, function( all, letter ) {
64+
return letter.toUpperCase();
65+
} );
66+
}
67+
6268
function getElementStyles( elem ) {
6369
var styles = {};
6470
var style = elem.ownerDocument.defaultView ?
@@ -71,7 +77,7 @@ function getElementStyles( elem ) {
7177
while ( len-- ) {
7278
key = style[ len ];
7379
if ( typeof style[ key ] === "string" ) {
74-
styles[ $.camelCase( key ) ] = style[ key ];
80+
styles[ camelCase( key ) ] = style[ key ];
7581
}
7682
}
7783

tests/unit/button/deprecated.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@
5656
<button id="button1">Button</button>
5757
<a href="#" id="anchor-button">Anchor Button</a>
5858

59+
<div class="mixed">
60+
<a href="#" id="mixed-anchor">Anchor</a>
61+
<button id="mixed-button" disabled>Button</button>
62+
<input type="button" value="Button" id="mixed-input">
63+
<input type="checkbox" id="mixed-check" name="check"><label for="mixed-check">Check</label>
64+
<input type="radio" id="mixed-radio" name="radio"><label for="mixed-radio">Radio</label>
65+
</div>
66+
5967
</div>
6068
</body>
6169
</html>

tests/unit/button/deprecated.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,22 @@ QUnit.test( "icon / icons options properly proxied", function( assert ) {
194194
"Icons secondary option sets iconPosition option to end on init" );
195195
} );
196196

197+
QUnit.test( "Calling button on a collection of mixed types works correctly", function( assert ) {
198+
assert.expect( 5 );
199+
200+
var group = $( ".mixed" ).children();
201+
202+
group.button();
203+
204+
$.each( {
205+
anchor: "button",
206+
button: "button",
207+
check: "checkboxradio",
208+
input: "button",
209+
radio: "checkboxradio"
210+
}, function( type, widget ) {
211+
assert.ok( $( "#mixed-" + type )[ widget ]( "instance" ), type + " is a " + widget );
212+
} );
213+
} );
214+
197215
} );

tests/unit/core/core.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ QUnit.test( "uniqueId / removeUniqueId", function( assert ) {
142142
} );
143143

144144
QUnit.test( "Labels", function( assert ) {
145-
assert.expect( 2 );
145+
assert.expect( 3 );
146146

147147
var expected = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ];
148148
var dom = $( "#labels-fragment" );
@@ -165,6 +165,8 @@ QUnit.test( "Labels", function( assert ) {
165165
// Detach the dom to test on a fragment
166166
dom.detach();
167167
testLabels( "document fragments" );
168+
169+
assert.equal( $().labels().length, 0, "No element" );
168170
} );
169171

170172
( function() {

tests/unit/menu/events.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,9 @@ QUnit.test( "handle keyboard navigation and mouse click on menu with dividers an
670670
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
671671
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
672672
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
673-
assert.equal( logOutput(), "keydown,3,4,7", "Keydown focus skips divider and group label" );
673+
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
674+
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
675+
assert.equal( logOutput(), "keydown,1,2,3,4,7", "Keydown focus skips divider and group label" );
674676
ready();
675677
}
676678
} );
@@ -755,4 +757,26 @@ QUnit.test( "#10571: When typing in a menu, only menu-items should be focused",
755757
} );
756758
} );
757759

760+
QUnit.test( "#15157: Must not focus menu dividers with the keyboard", function( assert ) {
761+
var ready = assert.async();
762+
assert.expect( 6 );
763+
764+
var element = $( "#menu-with-dividers" ).menu( {
765+
focus: function( event, ui ) {
766+
assert.hasClasses( ui.item, "ui-menu-item", "Should have menu item class" );
767+
log( ui.item.text() );
768+
}
769+
} );
770+
771+
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
772+
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
773+
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
774+
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
775+
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
776+
setTimeout( function() {
777+
assert.equal( logOutput(), "beginning,middle,end,beginning,end", "Should wrap around items" );
778+
ready();
779+
} );
780+
} );
781+
758782
} );

tests/unit/menu/menu.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,16 @@
323323
<li class="foo"><div>Addyston</div></li>
324324
<li class="foo"><div>Adelphi</div></li>
325325
</ul>
326+
327+
<ul id="menu-with-dividers">
328+
<li>-</li>
329+
<li>beginning</li>
330+
<li>-</li>
331+
<li>middle</li>
332+
<li>-</li>
333+
<li>end</li>
334+
<li>-</li>
335+
</ul>
326336
</div>
327337
</body>
328338
</html>

tests/unit/resizable/options.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,10 @@ QUnit.test( "zIndex, applied to all handles", function( assert ) {
434434
} );
435435

436436
QUnit.test( "setOption handles", function( assert ) {
437-
assert.expect( 15 );
437+
assert.expect( 19 );
438438

439+
// https://bugs.jqueryui.com/ticket/3423
440+
// https://bugs.jqueryui.com/ticket/15084
439441
var target = $( "<div></div>" ).resizable(),
440442
target2 = $( "<div>" +
441443
"<div class='ui-resizable-handle ui-resizable-e'></div>" +
@@ -470,6 +472,12 @@ QUnit.test( "setOption handles", function( assert ) {
470472

471473
target2.resizable( "option", "handles", "e, s, w" );
472474
checkHandles( target2, [ "e", "s", "w" ] );
475+
476+
target.resizable( "destroy" );
477+
checkHandles( target, [ ] );
478+
479+
target2.resizable( "destroy" );
480+
checkHandles( target2, [ "e", "w" ] );
473481
} );
474482

475483
QUnit.test( "alsoResize + containment", function( assert ) {

tests/unit/selectmenu/core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,13 @@ $.each( [
251251
wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" );
252252

253253
button.trigger( "click" );
254-
wrappers.first().simulate( "mouseover" ).trigger( "click" );
254+
wrappers.first().simulate( "mouseover", { clientX: 2, clientY: 2 } ).trigger( "click" );
255255
assert.equal( element[ 0 ].selectedIndex, 0, "First item is selected" );
256256
button.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
257257
assert.equal( element[ 0 ].selectedIndex, 0, "No looping beyond first item" );
258258

259259
button.trigger( "click" );
260-
wrappers.last().simulate( "mouseover" ).trigger( "click" );
260+
wrappers.last().simulate( "mouseover", { clientX: 3, clientY: 3 } ).trigger( "click" );
261261
assert.equal( element[ 0 ].selectedIndex, wrappers.length - 1, "Last item is selected" );
262262
button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
263263
assert.equal( element[ 0 ].selectedIndex, wrappers.length - 1, "No looping behind last item" );

tests/unit/selectmenu/events.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ QUnit.test( "focus", function( assert ) {
8989
button.trigger( "click" );
9090
links = menu.find( "li.ui-menu-item" );
9191
optionIndex = 0;
92-
links.eq( optionIndex ).simulate( "mouseover" );
92+
links.eq( optionIndex ).simulate( "mouseover", { clientX: 2, clientY: 2 } );
9393
optionIndex += 1;
94-
links.eq( optionIndex ).simulate( "mouseover" );
94+
links.eq( optionIndex ).simulate( "mouseover", { clientX: 3, clientY: 3 } );
9595

9696
// This tests for unwanted, additional focus event on close
9797
that.element.selectmenu( "close" );

tests/unit/widget/extend.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ define( [
55
], function( QUnit, $ ) {
66

77
QUnit.test( "$.widget.extend()", function( assert ) {
8-
assert.expect( 27 );
8+
assert.expect( 28 );
99

1010
var ret, empty, optionsWithLength, optionsWithDate, myKlass, customObject, optionsWithCustomObject, nullUndef,
1111
target, recursive, obj, input, output,
@@ -108,6 +108,11 @@ QUnit.test( "$.widget.extend()", function( assert ) {
108108
assert.deepEqual( input, output, "don't clone arrays" );
109109
input.key[ 0 ] = 10;
110110
assert.deepEqual( input, output, "don't clone arrays" );
111+
112+
input = Object.create( null );
113+
input.foo = "f";
114+
output = $.widget.extend( {}, input );
115+
assert.deepEqual( input, output, "Object with no prototype" );
111116
} );
112117

113118
} );

themes/base/slider.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
z-index: 2;
1818
width: 1.2em;
1919
height: 1.2em;
20-
cursor: default;
20+
cursor: pointer;
2121
-ms-touch-action: none;
2222
touch-action: none;
2323
}

ui/data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
factory( jQuery );
2424
}
2525
} ( function( $ ) {
26-
return $.extend( $.expr[ ":" ], {
26+
return $.extend( $.expr.pseudos, {
2727
data: $.expr.createPseudo ?
2828
$.expr.createPseudo( function( dataName ) {
2929
return function( elem ) {

ui/effect.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,12 @@ $.each(
746746
}
747747
);
748748

749+
function camelCase( string ) {
750+
return string.replace( /-([\da-z])/gi, function( all, letter ) {
751+
return letter.toUpperCase();
752+
} );
753+
}
754+
749755
function getElementStyles( elem ) {
750756
var key, len,
751757
style = elem.ownerDocument.defaultView ?
@@ -758,7 +764,7 @@ function getElementStyles( elem ) {
758764
while ( len-- ) {
759765
key = style[ len ];
760766
if ( typeof style[ key ] === "string" ) {
761-
styles[ $.camelCase( key ) ] = style[ key ];
767+
styles[ camelCase( key ) ] = style[ key ];
762768
}
763769
}
764770

ui/focusable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function visible( element ) {
7373
return visibility !== "hidden";
7474
}
7575

76-
$.extend( $.expr[ ":" ], {
76+
$.extend( $.expr.pseudos, {
7777
focusable: function( element ) {
7878
return $.ui.focusable( element, $.attr( element, "tabindex" ) != null );
7979
}

ui/jquery-1-7.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* jQuery UI Support for jQuery core 1.7.x @VERSION
2+
* jQuery UI Support for jQuery core 1.7.x and newer @VERSION
33
* http://jqueryui.com
44
*
55
* Copyright jQuery Foundation and other contributors
@@ -86,4 +86,16 @@ if ( $.fn.jquery.substring( 0, 3 ) === "1.7" ) {
8686
};
8787
}
8888

89+
// Support: jQuery 1.9.x or older
90+
// $.expr[ ":" ] is deprecated.
91+
if ( !$.expr.pseudos ) {
92+
$.expr.pseudos = $.expr[ ":" ];
93+
}
94+
95+
// Support: jQuery 1.11.x or older
96+
// $.unique has been renamed to $.uniqueSort
97+
if ( !$.uniqueSort ) {
98+
$.uniqueSort = $.unique;
99+
}
100+
89101
} ) );

ui/labels.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
return $.fn.labels = function() {
2828
var ancestor, selector, id, labels, ancestors;
2929

30+
if ( !this.length ) {
31+
return this.pushStack( [] );
32+
}
33+
3034
// Check control.labels first
3135
if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
3236
return this.pushStack( this[ 0 ].labels );

ui/position.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ $.position = {
8484
return cachedScrollbarWidth;
8585
}
8686
var w1, w2,
87-
div = $( "<div " +
88-
"style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" +
89-
"<div style='height:100px;width:auto;'></div></div>" ),
87+
div = $( "<div style=" +
88+
"'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" +
89+
"<div style='height:300px;width:auto;'></div></div>" ),
9090
innerDiv = div.children()[ 0 ];
9191

9292
$( "body" ).append( div );

ui/tabbable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
}
2525
} ( function( $ ) {
2626

27-
return $.extend( $.expr[ ":" ], {
27+
return $.extend( $.expr.pseudos, {
2828
tabbable: function( element ) {
2929
var tabIndex = $.attr( element, "tabindex" ),
3030
hasTabindex = tabIndex != null;

0 commit comments

Comments
 (0)