Skip to content
Permalink
Browse files

Merge branch 'master' into selectmenu

  • Loading branch information
fnagel committed Apr 2, 2013
2 parents 26c528a + 09b3533 commit 73c7342bc4418a902bf021c89e7d2c43172e004e
@@ -15,7 +15,6 @@
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$.datepicker.setDefaults( $.datepicker.regional[ "" ] );
$( "#datepicker" ).datepicker( $.datepicker.regional[ "fr" ] );
$( "#locale" ).change(function() {
$( "#datepicker" ).datepicker( "option",
@@ -28,8 +27,9 @@

<p>Date: <input type="text" id="datepicker"/>&nbsp;
<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="">English</option>
<option value="fr" selected="selected">French (Fran&ccedil;ais)</option>
<option value="he">Hebrew (&#8235;(&#1506;&#1489;&#1512;&#1497;&#1514;</option>
</select></p>
@@ -53,7 +53,7 @@
],
"dependencies": {},
"devDependencies": {
"grunt": "0.4.0",
"grunt": "0.4.1",
"grunt-contrib-jshint": "0.1.1",
"grunt-contrib-uglify": "0.1.1",
"grunt-contrib-concat": "0.1.3",
@@ -13,25 +13,25 @@
"trailing": true,
"undef": true,
"unused": true,
"predef": [
"asyncTest",
"closeEnough",
"deepEqual",
"domEqual",
"equal",
"expect",
"Globalize",
"module",
"notEqual",
"notDeepEqual",
"notStrictEqual",
"ok",
"QUnit",
"start",
"strictEqual",
"stop",
"test",
"TestHelpers",
"JSHINT"
]
"globals": {
"asyncTest": false,
"closeEnough": false,
"deepEqual": false,
"domEqual": false,
"equal": false,
"expect": false,
"Globalize": false,
"module": false,
"notEqual": false,
"notDeepEqual": false,
"notStrictEqual": false,
"ok": false,
"QUnit": true,
"start": false,
"strictEqual": false,
"stop": false,
"test": false,
"TestHelpers": true,
"JSHINT": false
}
}
@@ -35,7 +35,7 @@ test( "enable/disable", function() {
});

test( "refresh", function() {
expect( 17 );
expect( 19 );
var element = $( "#navigation" )
.parent()
.height( 300 )
@@ -109,6 +109,15 @@ test( "refresh", function() {
element.find( "div.foo" ).eq( 0 ).remove();
element.accordion( "refresh" );
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() {
@@ -188,4 +188,14 @@ test( "ARIA", function() {
"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 ) );
@@ -15,7 +15,7 @@ test("destroy", function() {

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

var element = $( "<a href='#'></a>" );
element.button({ disabled: true }).button( "refresh" );
ok( element.button( "option", "disabled" ), "Anchor button should remain disabled after refresh" ); //See #8237
@@ -4,18 +4,7 @@

(function( $ ) {

var relativeElement, absoluteElement;

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();
}
});
module( "draggable: core" );

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

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

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

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

relativeElement
$( "#draggable1" )
.append(
$("<div>")
.addClass("ui-resizable-handle ui-resizable-w")
.append( $("<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
handle.simulate("mouseover").simulate( "drag", { dx: -50 } );
@@ -85,4 +74,24 @@ test( "resizable handle with complex markup (#8756 / #8757)", function() {
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 );
@@ -378,7 +378,7 @@ test( "containment, account for border", function() {
});

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

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

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

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

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

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

$( "#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" });

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() {
@@ -1113,7 +1112,8 @@ test( "#6817: auto scroll goes double distance when dragging", function() {
scroll: true,
stop: function( e, ui ) {
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" ),
@@ -1138,7 +1138,7 @@ test( "#6817: auto scroll goes double distance when dragging", function() {
});

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

var newX, newY,
snapTolerance = 15,
@@ -1164,7 +1164,9 @@ test( "snap, snapMode, and snapTolerance", function() {
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;

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

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

var newX, newY,
snapTolerance = 15,
@@ -1287,7 +1289,9 @@ test( "#8459: element can snap to an element that was removed during drag", func
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() {
@@ -221,7 +221,9 @@ test( "of", function() {
});

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

var offset;

$( "#elx" ).position({
my: "left top",
@@ -261,15 +263,19 @@ test( "offsets", function() {
of: "#parentx",
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({
my: "left+10.4 top-10.6",
at: "left bottom",
of: "#parentx",
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({
my: "left+right top-left",
@@ -38,27 +38,30 @@ test( "stop", function() {
test( "mousedown: initial position of helper", function() {
expect( 2 );

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

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

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

helper = $(".ui-selectable-helper");
equal( helper.css("top"), "11px", "Scroll top should be accounted for." );
equal( helper.css("left"), "11px", "Scroll left should be accounted for." );
// we do a GTE comparison here because IE7 erroneously subtracts
// 2 pixels from a simulated mousedown for clientX/Y
// 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
element.simulate("mouseup");
element.simulate( "mouseup" );
contentToForceScroll.remove();
$( window ).scrollTop( 0 ).scrollLeft( 0 );
});
@@ -44,6 +44,9 @@
border-width: 0;
height:19px;
}
#sortable-table {
width: 100%;
}
</style>
</head>
<body>

0 comments on commit 73c7342

Please sign in to comment.
You can’t perform that action at this time.