Skip to content

Commit

Permalink
Merge branch 'master' into datepicker
Browse files Browse the repository at this point in the history
# Conflicts:
#	ui/i18n/datepicker-pt.js
  • Loading branch information
fnagel committed Aug 26, 2017
2 parents 2b611ba + 74f8a0a commit 1b885ff
Show file tree
Hide file tree
Showing 30 changed files with 472 additions and 232 deletions.
2 changes: 1 addition & 1 deletion demos/autocomplete/combobox.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
.autocomplete({
delay: 0,
minLength: 0,
source: $.proxy( this, "_source" )
source: this._source.bind( this )
})
.tooltip({
classes: {
Expand Down
2 changes: 1 addition & 1 deletion demos/effect/easing.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
canvas.width = width;
canvas.height = height;
var drawHeight = height * 0.8,
cradius = 10;
cradius = 10,
ctx = canvas.getContext( "2d" );
ctx.fillStyle = "black";

Expand Down
6 changes: 3 additions & 3 deletions tests/lib/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ function migrateUrl() {
}
}

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

requireTests( modules, noBackCompat );
Expand Down
8 changes: 7 additions & 1 deletion tests/lib/qunit-assert-domequal.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ domEqual.attributes = [
"title"
];

function camelCase( string ) {
return string.replace( /-([\da-z])/gi, function( all, letter ) {
return letter.toUpperCase();
} );
}

function getElementStyles( elem ) {
var styles = {};
var style = elem.ownerDocument.defaultView ?
Expand All @@ -71,7 +77,7 @@ function getElementStyles( elem ) {
while ( len-- ) {
key = style[ len ];
if ( typeof style[ key ] === "string" ) {
styles[ $.camelCase( key ) ] = style[ key ];
styles[ camelCase( key ) ] = style[ key ];
}
}

Expand Down
8 changes: 8 additions & 0 deletions tests/unit/button/deprecated.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
<button id="button1">Button</button>
<a href="#" id="anchor-button">Anchor Button</a>

<div class="mixed">
<a href="#" id="mixed-anchor">Anchor</a>
<button id="mixed-button" disabled>Button</button>
<input type="button" value="Button" id="mixed-input">
<input type="checkbox" id="mixed-check" name="check"><label for="mixed-check">Check</label>
<input type="radio" id="mixed-radio" name="radio"><label for="mixed-radio">Radio</label>
</div>

</div>
</body>
</html>
18 changes: 18 additions & 0 deletions tests/unit/button/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,22 @@ QUnit.test( "icon / icons options properly proxied", function( assert ) {
"Icons secondary option sets iconPosition option to end on init" );
} );

QUnit.test( "Calling button on a collection of mixed types works correctly", function( assert ) {
assert.expect( 5 );

var group = $( ".mixed" ).children();

group.button();

$.each( {
anchor: "button",
button: "button",
check: "checkboxradio",
input: "button",
radio: "checkboxradio"
}, function( type, widget ) {
assert.ok( $( "#mixed-" + type )[ widget ]( "instance" ), type + " is a " + widget );
} );
} );

} );
4 changes: 3 additions & 1 deletion tests/unit/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ QUnit.test( "uniqueId / removeUniqueId", function( assert ) {
} );

QUnit.test( "Labels", function( assert ) {
assert.expect( 2 );
assert.expect( 3 );

var expected = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ];
var dom = $( "#labels-fragment" );
Expand All @@ -165,6 +165,8 @@ QUnit.test( "Labels", function( assert ) {
// Detach the dom to test on a fragment
dom.detach();
testLabels( "document fragments" );

assert.equal( $().labels().length, 0, "No element" );
} );

( function() {
Expand Down
26 changes: 25 additions & 1 deletion tests/unit/menu/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,9 @@ QUnit.test( "handle keyboard navigation and mouse click on menu with dividers an
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
assert.equal( logOutput(), "keydown,3,4,7", "Keydown focus skips divider and group label" );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
assert.equal( logOutput(), "keydown,1,2,3,4,7", "Keydown focus skips divider and group label" );
ready();
}
} );
Expand Down Expand Up @@ -755,4 +757,26 @@ QUnit.test( "#10571: When typing in a menu, only menu-items should be focused",
} );
} );

QUnit.test( "#15157: Must not focus menu dividers with the keyboard", function( assert ) {
var ready = assert.async();
assert.expect( 6 );

var element = $( "#menu-with-dividers" ).menu( {
focus: function( event, ui ) {
assert.hasClasses( ui.item, "ui-menu-item", "Should have menu item class" );
log( ui.item.text() );
}
} );

element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
setTimeout( function() {
assert.equal( logOutput(), "beginning,middle,end,beginning,end", "Should wrap around items" );
ready();
} );
} );

} );
10 changes: 10 additions & 0 deletions tests/unit/menu/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,16 @@
<li class="foo"><div>Addyston</div></li>
<li class="foo"><div>Adelphi</div></li>
</ul>

<ul id="menu-with-dividers">
<li>-</li>
<li>beginning</li>
<li>-</li>
<li>middle</li>
<li>-</li>
<li>end</li>
<li>-</li>
</ul>
</div>
</body>
</html>
10 changes: 9 additions & 1 deletion tests/unit/resizable/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,10 @@ QUnit.test( "zIndex, applied to all handles", function( assert ) {
} );

QUnit.test( "setOption handles", function( assert ) {
assert.expect( 15 );
assert.expect( 19 );

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

target2.resizable( "option", "handles", "e, s, w" );
checkHandles( target2, [ "e", "s", "w" ] );

target.resizable( "destroy" );
checkHandles( target, [ ] );

target2.resizable( "destroy" );
checkHandles( target2, [ "e", "w" ] );
} );

QUnit.test( "alsoResize + containment", function( assert ) {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/selectmenu/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,13 @@ $.each( [
wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" );

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

button.trigger( "click" );
wrappers.last().simulate( "mouseover" ).trigger( "click" );
wrappers.last().simulate( "mouseover", { clientX: 3, clientY: 3 } ).trigger( "click" );
assert.equal( element[ 0 ].selectedIndex, wrappers.length - 1, "Last item is selected" );
button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
assert.equal( element[ 0 ].selectedIndex, wrappers.length - 1, "No looping behind last item" );
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/selectmenu/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ QUnit.test( "focus", function( assert ) {
button.trigger( "click" );
links = menu.find( "li.ui-menu-item" );
optionIndex = 0;
links.eq( optionIndex ).simulate( "mouseover" );
links.eq( optionIndex ).simulate( "mouseover", { clientX: 2, clientY: 2 } );
optionIndex += 1;
links.eq( optionIndex ).simulate( "mouseover" );
links.eq( optionIndex ).simulate( "mouseover", { clientX: 3, clientY: 3 } );

// This tests for unwanted, additional focus event on close
that.element.selectmenu( "close" );
Expand Down
7 changes: 6 additions & 1 deletion tests/unit/widget/extend.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ define( [
], function( QUnit, $ ) {

QUnit.test( "$.widget.extend()", function( assert ) {
assert.expect( 27 );
assert.expect( 28 );

var ret, empty, optionsWithLength, optionsWithDate, myKlass, customObject, optionsWithCustomObject, nullUndef,
target, recursive, obj, input, output,
Expand Down Expand Up @@ -108,6 +108,11 @@ QUnit.test( "$.widget.extend()", function( assert ) {
assert.deepEqual( input, output, "don't clone arrays" );
input.key[ 0 ] = 10;
assert.deepEqual( input, output, "don't clone arrays" );

input = Object.create( null );
input.foo = "f";
output = $.widget.extend( {}, input );
assert.deepEqual( input, output, "Object with no prototype" );
} );

} );
2 changes: 1 addition & 1 deletion themes/base/slider.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
z-index: 2;
width: 1.2em;
height: 1.2em;
cursor: default;
cursor: pointer;
-ms-touch-action: none;
touch-action: none;
}
Expand Down
2 changes: 1 addition & 1 deletion ui/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
factory( jQuery );
}
} ( function( $ ) {
return $.extend( $.expr[ ":" ], {
return $.extend( $.expr.pseudos, {
data: $.expr.createPseudo ?
$.expr.createPseudo( function( dataName ) {
return function( elem ) {
Expand Down
8 changes: 7 additions & 1 deletion ui/effect.js
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,12 @@ $.each(
}
);

function camelCase( string ) {
return string.replace( /-([\da-z])/gi, function( all, letter ) {
return letter.toUpperCase();
} );
}

function getElementStyles( elem ) {
var key, len,
style = elem.ownerDocument.defaultView ?
Expand All @@ -758,7 +764,7 @@ function getElementStyles( elem ) {
while ( len-- ) {
key = style[ len ];
if ( typeof style[ key ] === "string" ) {
styles[ $.camelCase( key ) ] = style[ key ];
styles[ camelCase( key ) ] = style[ key ];
}
}

Expand Down
2 changes: 1 addition & 1 deletion ui/focusable.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function visible( element ) {
return visibility !== "hidden";
}

$.extend( $.expr[ ":" ], {
$.extend( $.expr.pseudos, {
focusable: function( element ) {
return $.ui.focusable( element, $.attr( element, "tabindex" ) != null );
}
Expand Down
14 changes: 13 additions & 1 deletion ui/jquery-1-7.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* jQuery UI Support for jQuery core 1.7.x @VERSION
* jQuery UI Support for jQuery core 1.7.x and newer @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
Expand Down Expand Up @@ -86,4 +86,16 @@ if ( $.fn.jquery.substring( 0, 3 ) === "1.7" ) {
};
}

// Support: jQuery 1.9.x or older
// $.expr[ ":" ] is deprecated.
if ( !$.expr.pseudos ) {
$.expr.pseudos = $.expr[ ":" ];
}

// Support: jQuery 1.11.x or older
// $.unique has been renamed to $.uniqueSort
if ( !$.uniqueSort ) {
$.uniqueSort = $.unique;
}

} ) );
4 changes: 4 additions & 0 deletions ui/labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
return $.fn.labels = function() {
var ancestor, selector, id, labels, ancestors;

if ( !this.length ) {
return this.pushStack( [] );
}

// Check control.labels first
if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
return this.pushStack( this[ 0 ].labels );
Expand Down
6 changes: 3 additions & 3 deletions ui/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ $.position = {
return cachedScrollbarWidth;
}
var w1, w2,
div = $( "<div " +
"style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" +
"<div style='height:100px;width:auto;'></div></div>" ),
div = $( "<div style=" +
"'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" +
"<div style='height:300px;width:auto;'></div></div>" ),
innerDiv = div.children()[ 0 ];

$( "body" ).append( div );
Expand Down
2 changes: 1 addition & 1 deletion ui/tabbable.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}
} ( function( $ ) {

return $.extend( $.expr[ ":" ], {
return $.extend( $.expr.pseudos, {
tabbable: function( element ) {
var tabIndex = $.attr( element, "tabindex" ),
hasTabindex = tabIndex != null;
Expand Down
Loading

0 comments on commit 1b885ff

Please sign in to comment.