Skip to content

Commit

Permalink
Merge branch 'master' into selectmenu
Browse files Browse the repository at this point in the history
  • Loading branch information
fnagel committed Apr 2, 2013
2 parents 26c528a + 09b3533 commit 73c7342
Show file tree
Hide file tree
Showing 22 changed files with 328 additions and 195 deletions.
4 changes: 2 additions & 2 deletions demos/datepicker/localization.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<link rel="stylesheet" href="../demos.css"> <link rel="stylesheet" href="../demos.css">
<script> <script>
$(function() { $(function() {
$.datepicker.setDefaults( $.datepicker.regional[ "" ] );
$( "#datepicker" ).datepicker( $.datepicker.regional[ "fr" ] ); $( "#datepicker" ).datepicker( $.datepicker.regional[ "fr" ] );
$( "#locale" ).change(function() { $( "#locale" ).change(function() {
$( "#datepicker" ).datepicker( "option", $( "#datepicker" ).datepicker( "option",
Expand All @@ -28,8 +27,9 @@


<p>Date: <input type="text" id="datepicker"/>&nbsp; <p>Date: <input type="text" id="datepicker"/>&nbsp;
<select id="locale"> <select id="locale">
<option value="ar">Arabic (&#8235;(&#1604;&#1593;&#1585;&#1576;&#1610;</option> <option value="ar">Arabic (&#8235;(&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;</option>
<option value="zh-TW">Chinese Traditional (&#32321;&#39636;&#20013;&#25991;)</option> <option value="zh-TW">Chinese Traditional (&#32321;&#39636;&#20013;&#25991;)</option>
<option value="">English</option>
<option value="fr" selected="selected">French (Fran&ccedil;ais)</option> <option value="fr" selected="selected">French (Fran&ccedil;ais)</option>
<option value="he">Hebrew (&#8235;(&#1506;&#1489;&#1512;&#1497;&#1514;</option> <option value="he">Hebrew (&#8235;(&#1506;&#1489;&#1512;&#1497;&#1514;</option>
</select></p> </select></p>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
], ],
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"grunt": "0.4.0", "grunt": "0.4.1",
"grunt-contrib-jshint": "0.1.1", "grunt-contrib-jshint": "0.1.1",
"grunt-contrib-uglify": "0.1.1", "grunt-contrib-uglify": "0.1.1",
"grunt-contrib-concat": "0.1.3", "grunt-contrib-concat": "0.1.3",
Expand Down
42 changes: 21 additions & 21 deletions tests/.jshintrc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@
"trailing": true, "trailing": true,
"undef": true, "undef": true,
"unused": true, "unused": true,
"predef": [ "globals": {
"asyncTest", "asyncTest": false,
"closeEnough", "closeEnough": false,
"deepEqual", "deepEqual": false,
"domEqual", "domEqual": false,
"equal", "equal": false,
"expect", "expect": false,
"Globalize", "Globalize": false,
"module", "module": false,
"notEqual", "notEqual": false,
"notDeepEqual", "notDeepEqual": false,
"notStrictEqual", "notStrictEqual": false,
"ok", "ok": false,
"QUnit", "QUnit": true,
"start", "start": false,
"strictEqual", "strictEqual": false,
"stop", "stop": false,
"test", "test": false,
"TestHelpers", "TestHelpers": true,
"JSHINT" "JSHINT": false
] }
} }
11 changes: 10 additions & 1 deletion tests/unit/accordion/accordion_methods.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ test( "enable/disable", function() {
}); });


test( "refresh", function() { test( "refresh", function() {
expect( 17 ); expect( 19 );
var element = $( "#navigation" ) var element = $( "#navigation" )
.parent() .parent()
.height( 300 ) .height( 300 )
Expand Down Expand Up @@ -109,6 +109,15 @@ test( "refresh", function() {
element.find( "div.foo" ).eq( 0 ).remove(); element.find( "div.foo" ).eq( 0 ).remove();
element.accordion( "refresh" ); element.accordion( "refresh" );
state( element, 1 ); state( element, 1 );

// collapse all panels
element.accordion( "option", {
collapsible: true,
active: false
});
state( element, 0 );
element.accordion( "refresh" );
state( element, 0 );
}); });


test( "widget", function() { test( "widget", function() {
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/autocomplete/autocomplete_core.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -188,4 +188,14 @@ test( "ARIA", function() {
"Live region for multiple values" ); "Live region for multiple values" );
}); });


test( ".replaceWith() (#9172)", function() {
expect( 1 );

var element = $( "#autocomplete" ).autocomplete(),
replacement = "<div>test</div>",
parent = element.parent();
element.replaceWith( replacement );
equal( parent.html().toLowerCase(), replacement );
});

}( jQuery ) ); }( jQuery ) );
2 changes: 1 addition & 1 deletion tests/unit/button/button_methods.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test("destroy", function() {


test( "refresh: Ensure disabled state is preserved correctly.", function() { test( "refresh: Ensure disabled state is preserved correctly.", function() {
expect( 8 ); expect( 8 );

var element = $( "<a href='#'></a>" ); var element = $( "<a href='#'></a>" );
element.button({ disabled: true }).button( "refresh" ); element.button({ disabled: true }).button( "refresh" );
ok( element.button( "option", "disabled" ), "Anchor button should remain disabled after refresh" ); //See #8237 ok( element.button( "option", "disabled" ), "Anchor button should remain disabled after refresh" ); //See #8237
Expand Down
41 changes: 25 additions & 16 deletions tests/unit/draggable/draggable_core.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@


(function( $ ) { (function( $ ) {


var relativeElement, absoluteElement; module( "draggable: core" );

module( "draggable: core", {
setup: function() {
relativeElement = $("<div style='width: 200px; height: 100px;'>Relative</div>").appendTo("#qunit-fixture");
absoluteElement = $("<div style='background: green; width: 200px; height: 100px; position: absolute; top: 10px; left: 10px;'><span>Absolute</span></div>").appendTo("#qunit-fixture");
},
teardown: function() {
relativeElement.remove();
absoluteElement.remove();
}
});


test( "element types", function() { test( "element types", function() {
var typeNames = ( var typeNames = (
Expand Down Expand Up @@ -55,26 +44,26 @@ test( "element types", function() {


test( "No options, relative", function() { test( "No options, relative", function() {
expect( 1 ); expect( 1 );
TestHelpers.draggable.shouldMove( relativeElement.draggable() ); TestHelpers.draggable.shouldMove( $( "#draggable1" ).draggable() );
}); });


test( "No options, absolute", function() { test( "No options, absolute", function() {
expect( 1 ); expect( 1 );
TestHelpers.draggable.shouldMove( absoluteElement.draggable() ); TestHelpers.draggable.shouldMove( $( "#draggable2" ).draggable() );
}); });


test( "resizable handle with complex markup (#8756 / #8757)", function() { test( "resizable handle with complex markup (#8756 / #8757)", function() {
expect( 2 ); expect( 2 );


relativeElement $( "#draggable1" )
.append( .append(
$("<div>") $("<div>")
.addClass("ui-resizable-handle ui-resizable-w") .addClass("ui-resizable-handle ui-resizable-w")
.append( $("<div>") ) .append( $("<div>") )
); );


var handle = $(".ui-resizable-w div"), var handle = $(".ui-resizable-w div"),
target = relativeElement.draggable().resizable({ handles: "all" }); target = $( "#draggable1" ).draggable().resizable({ handles: "all" });


// todo: fix resizable so it doesn't require a mouseover // todo: fix resizable so it doesn't require a mouseover
handle.simulate("mouseover").simulate( "drag", { dx: -50 } ); handle.simulate("mouseover").simulate( "drag", { dx: -50 } );
Expand All @@ -85,4 +74,24 @@ test( "resizable handle with complex markup (#8756 / #8757)", function() {
equal( target.width(), 200, "compare width" ); equal( target.width(), 200, "compare width" );
}); });


test( "#8269: Removing draggable element on drop", function() {
expect( 1 );

var element = $( "#draggable1" ).wrap( "<div id='wrapper' />" ).draggable(),
dropOffset = $( "#droppable" ).offset();

$( "#droppable" ).droppable({
drop: function() {
$( "#wrapper" ).remove();
ok( true, "element removed from DOM on drop" );
}
});

element.simulate( "drag", {
handle: "corner",
x: dropOffset.left,
y: dropOffset.top
});
});

})( jQuery ); })( jQuery );
26 changes: 15 additions & 11 deletions tests/unit/draggable/draggable_options.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ test( "containment, account for border", function() {
}); });


test( "containment, default, switching after initialization", function() { test( "containment, default, switching after initialization", function() {
expect( 2 ); expect( 3 );


var element = $( "#draggable1" ).draggable({ containment: false }); var element = $( "#draggable1" ).draggable({ containment: false });


Expand All @@ -393,9 +393,8 @@ test( "containment, default, switching after initialization", function() {


TestHelpers.draggable.testDrag( element, element, -100, -100, 0, 0 ); TestHelpers.draggable.testDrag( element, element, -100, -100, 0, 0 );


// TODO: Switching back to false does not update to false element.draggable( "option", "containment", false );
// element.draggable( "option", "containment", false ); TestHelpers.draggable.testDrag( element, element, -100, -100, -100, -100 );
// TestHelpers.draggable.testDrag( element, element, -100, -100, -100, -100 );
}); });


test( "{ cursor: 'auto' }, default", function() { test( "{ cursor: 'auto' }, default", function() {
Expand Down Expand Up @@ -1057,11 +1056,11 @@ test( "scope", function() {


$( "#droppable" ).droppable({ scope: "tasks" }); $( "#droppable" ).droppable({ scope: "tasks" });


TestHelpers.draggable.testDrag( element, element, 100, 100, 0, 0, "revert: valid reverts when dropped on a droppable" ); TestHelpers.draggable.testDrag( element, element, 100, 100, 0, 0, "revert: valid reverts when dropped on a droppable in scope" );


$( "#droppable" ).droppable( "destroy" ).droppable({ scope: "nottasks" }); $( "#droppable" ).droppable( "destroy" ).droppable({ scope: "nottasks" });


TestHelpers.draggable.testDrag( element, element, 100, 100, 100, 100, "revert: valid reverts when dropped on a droppable" ); TestHelpers.draggable.testDrag( element, element, 100, 100, 100, 100, "revert: valid reverts when dropped on a droppable out of scope" );
}); });


test( "scroll, scrollSensitivity, and scrollSpeed", function() { test( "scroll, scrollSensitivity, and scrollSpeed", function() {
Expand Down Expand Up @@ -1113,7 +1112,8 @@ test( "#6817: auto scroll goes double distance when dragging", function() {
scroll: true, scroll: true,
stop: function( e, ui ) { stop: function( e, ui ) {
equal( ui.offset.top, newY, "offset of item matches pointer position after scroll" ); equal( ui.offset.top, newY, "offset of item matches pointer position after scroll" );
equal( ui.offset.top - offsetBefore.top, distance, "offset of item only moves expected distance after scroll" ); // TODO: fix IE8 testswarm IFRAME positioning bug so closeEnough can be turned back to equal
closeEnough( ui.offset.top - offsetBefore.top, distance, 1, "offset of item only moves expected distance after scroll" );
} }
}), }),
scrollSensitivity = element.draggable( "option", "scrollSensitivity" ), scrollSensitivity = element.draggable( "option", "scrollSensitivity" ),
Expand All @@ -1138,7 +1138,7 @@ test( "#6817: auto scroll goes double distance when dragging", function() {
}); });


test( "snap, snapMode, and snapTolerance", function() { test( "snap, snapMode, and snapTolerance", function() {
expect( 9 ); expect( 10 );


var newX, newY, var newX, newY,
snapTolerance = 15, snapTolerance = 15,
Expand All @@ -1164,7 +1164,9 @@ test( "snap, snapMode, and snapTolerance", function() {
moves: 1 moves: 1
}); });


deepEqual( element.offset(), { top: newY, left: newX }, "doesn't snap outside the snapTolerance" ); // TODO: fix IE8 testswarm IFRAME positioning bug so closeEnough can be turned back to equal
closeEnough( element.offset().left, newX, 1, "doesn't snap outside the snapTolerance" );
closeEnough( element.offset().top, newY, 1, "doesn't snap outside the snapTolerance" );


newX += 3; newX += 3;


Expand Down Expand Up @@ -1258,7 +1260,7 @@ test( "snap, snapMode, and snapTolerance", function() {
}); });


test( "#8459: element can snap to an element that was removed during drag", function() { test( "#8459: element can snap to an element that was removed during drag", function() {
expect( 1 ); expect( 2 );


var newX, newY, var newX, newY,
snapTolerance = 15, snapTolerance = 15,
Expand Down Expand Up @@ -1287,7 +1289,9 @@ test( "#8459: element can snap to an element that was removed during drag", func
moves: 1 moves: 1
}); });


deepEqual( element.offset(), { top: newY, left: newX }, "doesn't snap to a removed element" ); // TODO: fix IE8 testswarm IFRAME positioning bug so closeEnough can be turned back to equal
closeEnough( element.offset().left, newX, 1, "doesn't snap to a removed element" );
closeEnough( element.offset().top, newY, 1, "doesn't snap to a removed element" );
}); });


test( "#8165: Snapping large rectangles to small rectangles doesn't snap properly", function() { test( "#8165: Snapping large rectangles to small rectangles doesn't snap properly", function() {
Expand Down
12 changes: 9 additions & 3 deletions tests/unit/position/position_core.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ test( "of", function() {
}); });


test( "offsets", function() { test( "offsets", function() {
expect( 7 ); expect( 9 );

var offset;


$( "#elx" ).position({ $( "#elx" ).position({
my: "left top", my: "left top",
Expand Down Expand Up @@ -261,15 +263,19 @@ test( "offsets", function() {
of: "#parentx", of: "#parentx",
collision: "none" collision: "none"
}); });
deepEqual( $( "#elx" ).offset(), { top: 65, left: 37 }, "decimal percentage offsets in my" ); offset = $( "#elx" ).offset();
equal( Math.round( offset.top ), 65, "decimal percentage offsets in my" );
equal( Math.round( offset.left ), 37, "decimal percentage offsets in my" );


$( "#elx" ).position({ $( "#elx" ).position({
my: "left+10.4 top-10.6", my: "left+10.4 top-10.6",
at: "left bottom", at: "left bottom",
of: "#parentx", of: "#parentx",
collision: "none" collision: "none"
}); });
deepEqual( $( "#elx" ).offset(), { top: 49, left: 50 }, "decimal offsets in my" ); offset = $( "#elx" ).offset();
equal( Math.round( offset.top ), 49, "decimal offsets in my" );
equal( Math.round( offset.left ), 50, "decimal offsets in my" );


$( "#elx" ).position({ $( "#elx" ).position({
my: "left+right top-left", my: "left+right top-left",
Expand Down
27 changes: 15 additions & 12 deletions tests/unit/selectable/selectable_events.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,27 +38,30 @@ test( "stop", function() {
test( "mousedown: initial position of helper", function() { test( "mousedown: initial position of helper", function() {
expect( 2 ); expect( 2 );


var contentToForceScroll, helper, var helperOffset,
element = $("#selectable1").selectable(); element = $( "#selectable1" ).selectable(),
contentToForceScroll = $( "<div>" ).css({
height: "10000px",
width: "10000px"
});


contentToForceScroll = $("<div>").css({ contentToForceScroll.appendTo( "body" );
height: "10000px", $( window ).scrollTop( 100 ).scrollLeft( 100 );
width: "10000px"
});


contentToForceScroll.appendTo("body");
$( window ).scrollTop( 1 ).scrollLeft( 1 );
element.simulate( "mousedown", { element.simulate( "mousedown", {
clientX: 10, clientX: 10,
clientY: 10 clientY: 10
}); });


helper = $(".ui-selectable-helper"); // we do a GTE comparison here because IE7 erroneously subtracts
equal( helper.css("top"), "11px", "Scroll top should be accounted for." ); // 2 pixels from a simulated mousedown for clientX/Y
equal( helper.css("left"), "11px", "Scroll left should be accounted for." ); // Support: IE7
helperOffset = $( ".ui-selectable-helper" ).offset();
ok( helperOffset.top >= 99, "Scroll top should be accounted for." );
ok( helperOffset.left >= 99, "Scroll left should be accounted for." );


// Cleanup // Cleanup
element.simulate("mouseup"); element.simulate( "mouseup" );
contentToForceScroll.remove(); contentToForceScroll.remove();
$( window ).scrollTop( 0 ).scrollLeft( 0 ); $( window ).scrollTop( 0 ).scrollLeft( 0 );
}); });
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/sortable/sortable.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
border-width: 0; border-width: 0;
height:19px; height:19px;
} }
#sortable-table {
width: 100%;
}
</style> </style>
</head> </head>
<body> <body>
Expand Down
Loading

0 comments on commit 73c7342

Please sign in to comment.