Large diffs are not rendered by default.

@@ -0,0 +1,57 @@
TestHelpers.draggable = {
// todo: remove the unreliable offset hacks
unreliableOffset: $.ui.ie && ( !document.documentMode || document.documentMode < 8 ) ? 2 : 0,
drag: function(handle, dx, dy) {
$(handle).simulate("drag", {
dx: dx || 0,
dy: dy || 0
});
},
testDrag: function(el, handle, dx, dy, expectedDX, expectedDY, msg) {
var offsetAfter, actual, expected,
offsetBefore = el.offset();

TestHelpers.draggable.drag(handle, dx, dy);
offsetAfter = el.offset();

actual = { left: offsetAfter.left, top: offsetAfter.top },
expected = { left: offsetBefore.left + expectedDX, top: offsetBefore.top + expectedDY };

msg = msg ? msg + "." : "";
deepEqual(actual, expected, 'dragged[' + dx + ', ' + dy + '] ' + msg);
},
shouldMove: function(el, why) {
TestHelpers.draggable.testDrag(el, el, 50, 50, 50, 50, why);
},
shouldNotMove: function(el, why) {
TestHelpers.draggable.testDrag(el, el, 50, 50, 0, 0, why);
},
testScroll: function(el, position ) {
var oldPosition = $("#main").css('position');
$("#main").css('position', position);
TestHelpers.draggable.shouldMove(el, position+' parent');
$("#main").css('position', oldPosition);
},
restoreScroll: function( what ) {
if( what ) {
$(document).scrollTop(0); $(document).scrollLeft(0);
} else {
$("#main").scrollTop(0); $("#main").scrollLeft(0);
}
},
setScroll: function( what ) {
if(what) {
// todo: currently, the draggable interaction doesn't properly account for scrolled pages,
// uncomment the line below to make the tests fail that should when the page is scrolled
// $(document).scrollTop(100); $(document).scrollLeft(100);
} else {
$("#main").scrollTop(100); $("#main").scrollLeft(100);
}
},
border: function(el, side) {
return parseInt(el.css('border-' + side + '-width'), 10) || 0;
},
margin: function(el, side) {
return parseInt(el.css('margin-' + side), 10) || 0;
}
};
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Droppable Test Suite</title>

<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>

<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../qunit-composite.css">
@@ -27,6 +27,7 @@
<script src="droppable_events.js"></script>
<script src="droppable_methods.js"></script>
<script src="droppable_options.js"></script>
<script src="droppable_test_helpers.js"></script>

<script src="../swarminject.js"></script>
</head>
@@ -2,17 +2,6 @@
* droppable_core.js
*/

TestHelpers.droppable = {
shouldDrop: function() {
// todo: actually implement this
ok(true, 'missing test - untested code is broken code');
},
shouldNotDrop: function() {
// todo: actually implement this
ok(true, 'missing test - untested code is broken code');
}
};

(function($) {

module("droppable: core");
@@ -43,6 +43,9 @@ test("destroy", function() {

test("enable", function() {
expect(7);

var el, expected, actual;

el = $("#droppable1").droppable({ disabled: true });
TestHelpers.droppable.shouldNotDrop();
el.droppable("enable");
@@ -55,13 +58,16 @@ test("enable", function() {
equal(el.droppable("option", "disabled"), false, "disabled option setter");
TestHelpers.droppable.shouldDrop();

var expected = $('<div></div>').droppable(),
actual = expected.droppable('enable');
expected = $('<div></div>').droppable(),
actual = expected.droppable('enable');
equal(actual, expected, 'enable is chainable');
});

test("disable", function() {
expect(7);

var el, actual, expected;

el = $("#droppable1").droppable({ disabled: false });
TestHelpers.droppable.shouldDrop();
el.droppable("disable");
@@ -74,8 +80,8 @@ test("disable", function() {
equal(el.droppable("option", "disabled"), true, "disabled option setter");
TestHelpers.droppable.shouldNotDrop();

var expected = $('<div></div>').droppable(),
actual = expected.droppable('disable');
expected = $('<div></div>').droppable(),
actual = expected.droppable('disable');
equal(actual, expected, 'disable is chainable');
});

@@ -24,14 +24,14 @@ test("activeClass", function() {
*/
test("{ addClasses: true }, default", function() {
expect( 1 );
el = $("<div></div>").droppable({ addClasses: true });
var el = $("<div></div>").droppable({ addClasses: true });
ok(el.is(".ui-droppable"), "'ui-droppable' class added");
el.droppable("destroy");
});

test("{ addClasses: false }", function() {
expect( 1 );
el = $("<div></div>").droppable({ addClasses: false });
var el = $("<div></div>").droppable({ addClasses: false });
ok(!el.is(".ui-droppable"), "'ui-droppable' class not added");
el.droppable("destroy");
});
@@ -0,0 +1,10 @@
TestHelpers.droppable = {
shouldDrop: function() {
// todo: actually implement this
ok(true, 'missing test - untested code is broken code');
},
shouldNotDrop: function() {
// todo: actually implement this
ok(true, 'missing test - untested code is broken code');
}
};
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Effects Test Suite</title>

<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>

<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../qunit-composite.css">
@@ -7,7 +7,7 @@
<link rel="stylesheet" href="../../themes/base/jquery.ui.core.css">
<link rel="stylesheet" href="../../themes/base/jquery.ui.theme.css">
<link rel="stylesheet" href="../index.css">
<script src="../jquery-1.8.2.js"></script>
<script src="../jquery-1.8.3.js"></script>
<script src="../index.js"></script>
</head>
<body>
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Menu Test Suite</title>

<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>

<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../qunit-composite.css">
@@ -60,6 +60,15 @@ test( "refresh", function() {
equal( element.find( ".ui-menu-item" ).length, 5, "Incorrect number of menu items" );
});

test( "refresh submenu", function() {
expect( 2 );
var element = $( "#menu2" ).menu();
equal( element.find( "ul:first .ui-menu-item" ).length, 3 );
element.find( "ul" ).andSelf().append( "<li><a href=\"#\">New Item</a></li>" );
element.menu("refresh");
equal( element.find( "ul:first .ui-menu-item" ).length, 4 );
});

test( "widget", function() {
expect( 2 );
var element = $( "#menu1" ).menu(),
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Position Test Suite</title>

<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>

<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../qunit-composite.css">
@@ -342,6 +342,8 @@ test( "collision: fit, no collision", function() {
}, "with offset" );
});

// Currently failing in IE8 due to the iframe used by TestSwarm
if ( !/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ) ) {
test( "collision: fit, collision", function() {
expect( 2 + (scrollTopSupport() ? 1 : 0) );

@@ -372,6 +374,7 @@ test( "collision: fit, collision", function() {
win.scrollTop( 0 ).scrollLeft( 0 );
}
});
}

test( "collision: flip, no collision", function() {
expect( 2 );
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Progressbar Test Suite</title>

<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>

<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../qunit-composite.css">
@@ -60,3 +60,21 @@ test( "{ max : 5, value : 10 }", function() {
});
deepEqual( 5, $( "#progressbar" ).progressbar( "value" ) );
});

test( "{ value : 10, max : 5 }", function() {
expect( 1 );
$("#progressbar").progressbar({
max: 5,
value: 10
});
deepEqual( 5, $( "#progressbar" ).progressbar( "value" ) );
});

test( "{ max : 5 }", function() {
expect( 1 );
$("#progressbar").progressbar({
max: 10,
value: 10
}).progressbar( "option", "max", 5 );
deepEqual( 5, $( "#progressbar" ).progressbar( "value" ) );
});
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Resizable Test Suite</title>

<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>

<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../qunit-composite.css">
@@ -26,8 +26,21 @@
<script src="resizable_events.js"></script>
<script src="resizable_methods.js"></script>
<script src="resizable_options.js"></script>
<script src="resizable_test_helpers.js"></script>

<script src="../swarminject.js"></script>

<style>
#resizable1 {
background: green;
height: 100px;
width: 100px;
}
#resizable2 {
height: 100px;
width: 100px;
}
</style>
</head>
<body>

@@ -38,8 +51,8 @@ <h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">

<div id="resizable1" style="background: green; width: 100px; height: 100px;">I'm a resizable.</div>
<img src="images/test.jpg" id="resizable2" style="width: 100px; height: 100px;" alt="solid gray">
<div id="resizable1">I'm a resizable.</div>
<img src="images/test.jpg" id="resizable2" alt="solid gray">

</div>
</body>
@@ -2,22 +2,6 @@
* resizable_core.js
*/

TestHelpers.resizable = {
drag: function(el, dx, dy, complete) {

// speed = sync -> Drag syncrhonously.
// speed = fast|slow -> Drag asyncrhonously - animated.

//this mouseover is to work around a limitation in resizable
//TODO: fix resizable so handle doesn't require mouseover in order to be used
$(el).simulate("mouseover");

return $(el).simulate("drag", {
dx: dx||0, dy: dy||0, speed: 'sync', complete: complete
});
}
};

(function($) {

module("resizable: core");
@@ -42,7 +26,7 @@ test("element types", function() {
*/

test("n", function() {
expect(2);
expect(4);

var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ handles: 'all' });

@@ -51,10 +35,13 @@ test("n", function() {

TestHelpers.resizable.drag(handle, 0, 50);
equal( target.height(), 100, "compare height" );

equal( target[0].style.left, "", "left should not be modified" );
equal( target[0].style.width, "", "width should not be modified" );
});

test("s", function() {
expect(2);
expect(5);

var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ handles: 'all' });

@@ -63,10 +50,14 @@ test("s", function() {

TestHelpers.resizable.drag(handle, 0, -50);
equal( target.height(), 100, "compare height" );

equal( target[0].style.top, "", "top should not be modified" );
equal( target[0].style.left, "", "left should not be modified" );
equal( target[0].style.width, "", "width should not be modified" );
});

test("e", function() {
expect(2);
expect(5);

var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ handles: 'all' });

@@ -75,10 +66,14 @@ test("e", function() {

TestHelpers.resizable.drag(handle, -50);
equal( target.width(), 100, "compare width" );

equal( target[0].style.height, "", "height should not be modified" );
equal( target[0].style.top, "", "top should not be modified" );
equal( target[0].style.left, "", "left should not be modified" );
});

test("w", function() {
expect(2);
expect(4);

var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ handles: 'all' });

@@ -87,10 +82,13 @@ test("w", function() {

TestHelpers.resizable.drag(handle, 50);
equal( target.width(), 100, "compare width" );

equal( target[0].style.height, "", "height should not be modified" );
equal( target[0].style.top, "", "top should not be modified" );
});

test("ne", function() {
expect(4);
expect(5);

var handle = '.ui-resizable-ne', target = $('#resizable1').css({ overflow: 'hidden' }).resizable({ handles: 'all' });

@@ -101,10 +99,12 @@ test("ne", function() {
TestHelpers.resizable.drag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );

equal( target[0].style.left, "", "left should not be modified" );
});

test("se", function() {
expect(4);
expect(6);

var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all' });

@@ -115,10 +115,13 @@ test("se", function() {
TestHelpers.resizable.drag(handle, -50, -50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );

equal( target[0].style.top, "", "top should not be modified" );
equal( target[0].style.left, "", "left should not be modified" );
});

test("sw", function() {
expect(4);
expect(5);

var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all' });

@@ -129,6 +132,8 @@ test("sw", function() {
TestHelpers.resizable.drag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );

equal( target[0].style.top, "", "top should not be modified" );
});

test("nw", function() {
@@ -145,4 +150,45 @@ test("nw", function() {
equal( target.height(), 100, "compare height" );
});

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

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

var handle = '.ui-resizable-w div', target = $('#resizable1').resizable({ handles: 'all' });

TestHelpers.resizable.drag(handle, -50);
equal( target.width(), 150, "compare width" );

TestHelpers.resizable.drag(handle, 50);
equal( target.width(), 100, "compare width" );
});

test("resizable accounts for scroll position correctly (#3815)", function() {
expect( 3 );

var position, top, left,
container = $("<div style='overflow:scroll;height:300px;width:300px;position:relative;'></div>").appendTo("#qunit-fixture"),
overflowed = $("<div style='width: 1000px; height: 1000px;'></div>").appendTo( container ),
el = $("<div style='height:100px;width:100px;position:absolute;top:10px;left:10px;'></div>").appendTo( overflowed ).resizable({ handles: 'all' }),
handle = ".ui-resizable-e";

container.scrollLeft( 100 ).scrollTop( 100 );

position = el.position();
left = el.css("left");
top = el.css("top");

TestHelpers.resizable.drag(handle, 50, 50);
deepEqual( el.position(), position, "position stays the same when resized" );
equal( el.css("left"), left, "css('left') stays the same when resized" );
equal( el.css("top"), top, "css('top') stays the same when resized" );
});

})(jQuery);
@@ -5,8 +5,165 @@

module("resizable: events");

// this is here to make JSHint pass "unused", and we don't want to
// remove the parameter for when we finally implement
$.noop();
test("start", function() {

expect(5);

var count = 0,
handle = ".ui-resizable-se";

$("#resizable1").resizable({
handles: "all",
start: function(event, ui) {
equal( ui.size.width, 100, "compare width" );
equal( ui.size.height, 100, "compare height" );
equal( ui.originalSize.width, 100, "compare original width" );
equal( ui.originalSize.height, 100, "compare original height" );
count++;
}
});

TestHelpers.resizable.drag(handle, 50, 50);

equal(count, 1, "start callback should happen exactly once");

});

test("resize", function() {

expect(9);

var count = 0,
handle = ".ui-resizable-se";

$("#resizable1").resizable({
handles: "all",
resize: function(event, ui) {
if (count === 0) {
equal( ui.size.width, 101, "compare width" );
equal( ui.size.height, 101, "compare height" );
equal( ui.originalSize.width, 100, "compare original width" );
equal( ui.originalSize.height, 100, "compare original height" );
} else {
equal( ui.size.width, 150, "compare width" );
equal( ui.size.height, 150, "compare height" );
equal( ui.originalSize.width, 100, "compare original width" );
equal( ui.originalSize.height, 100, "compare original height" );
}
count++;
}
});

TestHelpers.resizable.drag(handle, 50, 50);

equal(count, 2, "resize callback should happen exactly once per size adjustment");

});

test("resize (min/max dimensions)", function() {

expect(5);

var count = 0,
handle = ".ui-resizable-se";

$("#resizable1").resizable({
handles: "all",
minWidth: 60,
minHeight: 60,
maxWidth: 100,
maxHeight: 100,
resize: function(event, ui) {
equal( ui.size.width, 60, "compare width" );
equal( ui.size.height, 60, "compare height" );
equal( ui.originalSize.width, 100, "compare original width" );
equal( ui.originalSize.height, 100, "compare original height" );
count++;
}
});

TestHelpers.resizable.drag(handle, -50, -50);

equal(count, 1, "resize callback should happen exactly once per size adjustment");

});

test("resize (containment)", function() {

expect(5);

var count = 0,
handle = ".ui-resizable-se",
container = $("#resizable1").wrap("<div>").parent().css({
height: "100px",
width: "100px"
});

$("#resizable1").resizable({
handles: "all",
containment: container,
resize: function(event, ui) {
equal( ui.size.width, 50, "compare width" );
equal( ui.size.height, 50, "compare height" );
equal( ui.originalSize.width, 100, "compare original width" );
equal( ui.originalSize.height, 100, "compare original height" );
count++;
}
});

TestHelpers.resizable.drag(handle, -50, -50);

equal(count, 1, "resize callback should happen exactly once per size adjustment");

});

test("resize (grid)", function() {

expect(5);

var count = 0,
handle = ".ui-resizable-se";

$("#resizable1").resizable({
handles: "all",
grid: 50,
resize: function(event, ui) {
equal( ui.size.width, 150, "compare width" );
equal( ui.size.height, 150, "compare height" );
equal( ui.originalSize.width, 100, "compare original width" );
equal( ui.originalSize.height, 100, "compare original height" );
count++;
}
});

TestHelpers.resizable.drag(handle, 50, 50);

equal(count, 1, "resize callback should happen exactly once per grid-unit size adjustment");

});

test("stop", function() {

expect(5);

var count = 0,
handle = ".ui-resizable-se";

$("#resizable1").resizable({
handles: "all",
stop: function(event, ui) {
equal( ui.size.width, 150, "compare width" );
equal( ui.size.height, 150, "compare height" );
equal( ui.originalSize.width, 100, "compare original width" );
equal( ui.originalSize.height, 100, "compare original height" );
count++;
}
});

TestHelpers.resizable.drag(handle, 50, 50);

equal(count, 1, "stop callback should happen exactly once");

});

})(jQuery);
@@ -117,6 +117,20 @@ test("grid", function() {
equal( target.height(), 120, "compare height");
});

test("grid (min/max dimensions)", function() {
expect(4);

var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all", grid: 20, minWidth: 65, minHeight: 65, maxWidth: 135, maxHeight: 135 });

TestHelpers.resizable.drag(handle, 50, 50);
equal( target.width(), 120, "grid should respect maxWidth");
equal( target.height(), 120, "grid should respect maxHeight");

TestHelpers.resizable.drag(handle, -100, -100);
equal( target.width(), 80, "grid should respect minWidth");
equal( target.height(), 80, "grid should respect minHeight");
});

test("grid (wrapped)", function() {
expect(4);

@@ -0,0 +1,15 @@
TestHelpers.resizable = {
drag: function(el, dx, dy, complete) {

// speed = sync -> Drag syncrhonously.
// speed = fast|slow -> Drag asyncrhonously - animated.

//this mouseover is to work around a limitation in resizable
//TODO: fix resizable so handle doesn't require mouseover in order to be used
$(el).simulate("mouseover");

return $(el).simulate("drag", {
dx: dx||0, dy: dy||0, speed: 'sync', complete: complete
});
}
};
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Selectable Test Suite</title>

<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>

<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../qunit-composite.css">
@@ -26,6 +26,7 @@
<script src="selectable_events.js"></script>
<script src="selectable_methods.js"></script>
<script src="selectable_options.js"></script>
<script src="selectable_test_helpers.js"></script>

<script src="../swarminject.js"></script>
</head>
@@ -1,16 +1,3 @@
/*
* selectable_core.js
*/

TestHelpers.selectable = {
drag: function drag(el, dx, dy) {
var off = el.offset(),
pos = { clientX: off.left, clientY: off.top };
el.simulate("mousedown", pos);
$(document).simulate("mousemove", pos);
pos.clientX += dx;
pos.clientY += dy;
$(document).simulate("mousemove", pos);
$(document).simulate("mouseup", pos);
}
};
*/
@@ -26,7 +26,7 @@ test("autoRefresh", function() {
TestHelpers.selectable.drag(el, 1000, 1000);
equal(actual, 0);
sel.show();
TestHelpers.selectable.drag(el, 1000, 1000);
TestHelpers.selectable.drag( sel[ 0 ], 1000, 1000 );
equal(actual, sel.length);
el.selectable("destroy");
sel.show();
@@ -0,0 +1,8 @@
TestHelpers.selectable = {
drag: function( el, dx, dy ) {
$( el ).simulate( "drag", {
dx: dx || 0,
dy: dy || 0
});
}
};
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Slider Test Suite</title>

<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>

<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../qunit-composite.css">
@@ -70,7 +70,6 @@ test( "programmatic event triggers", function() {
})
.slider( "value", 0 );

QUnit.reset();
// Test values method
el = $( "<div></div>" )
.slider({
@@ -81,7 +80,6 @@ test( "programmatic event triggers", function() {
})
.slider( "values", [80, 90] );

QUnit.reset();
// Test value option
el = $( "<div></div>" )
.slider({
@@ -91,7 +89,6 @@ test( "programmatic event triggers", function() {
})
.slider( "option", "value", 0 );

QUnit.reset();
// Test values option
el = $( "<div></div>" )
.slider({
@@ -104,4 +101,55 @@ test( "programmatic event triggers", function() {

});

test( "mouse based interaction part two: when handles overlap", function() {
expect(4);

var el = $( "#slider1" )
.slider({
values: [ 0, 0, 0 ],
start: function( event, ui ) {
equal(handles.index(ui.handle), 2, "rightmost handle activated when overlapping at minimum (#3736)");
}
}),
handles = el.find( ".ui-slider-handle" );
handles.eq(0).simulate( "drag", { dx: 10 } );
el.slider( "destroy" );

el = $( "#slider1" )
.slider({
values: [ 10, 10, 10 ],
max: 10,
start: function( event, ui ) {
equal(handles.index(ui.handle), 0, "leftmost handle activated when overlapping at maximum");
}
}),
handles = el.find( ".ui-slider-handle" );
handles.eq(0).simulate( "drag", { dx: -10 } );
el.slider( "destroy" );

el = $( "#slider1" )
.slider({
values: [ 19, 20 ]
}),
handles = el.find( ".ui-slider-handle" );
handles.eq(0).simulate( "drag", { dx: 10 } );
el.one("slidestart", function(event, ui) {
equal(handles.index(ui.handle), 0, "left handle activated if left was moved last");
});
handles.eq(0).simulate( "drag", { dx: 10 } );
el.slider( "destroy" );

el = $( "#slider1" )
.slider({
values: [ 19, 20 ]
}),
handles = el.find( ".ui-slider-handle" );
handles.eq(1).simulate( "drag", { dx: -10 } );
el.one("slidestart", function(event, ui) {
equal(handles.index(ui.handle), 1, "right handle activated if right was moved last (#3467)");
});
handles.eq(0).simulate( "drag", { dx: 10 } );

});

}( jQuery ) );
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Sortable Test Suite</title>

<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>

<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../qunit-composite.css">
@@ -26,9 +26,26 @@
<script src="sortable_events.js"></script>
<script src="sortable_methods.js"></script>
<script src="sortable_options.js"></script>
<script src="sortable_test_helpers.js"></script>
<script src="sortable_tickets.js"></script>

<script src="../swarminject.js"></script>
<style>
#sortable, #sortable2 {
position:relative;
top:0;
left:0;
padding: 0;
margin: 1px;
border-width: 0;
}
#sortable li{
padding: 0;
margin: 0;
border-width: 0;
height:19px;
}
</style>
</head>
<body>

@@ -5,6 +5,7 @@ TestHelpers.commonWidgetTests( "sortable", {
cancel: "input,textarea,button,select,option",
connectWith: false,
containment: false,
create: null,
cursor: "auto",
cursorAt: false,
delay: 0,
@@ -1,13 +1,3 @@
/*
* sortable_core.js
*/

(function($) {

module("sortable: core");

// this is here to make JSHint pass "unused", and we don't want to
// remove the parameter for when we finally implement
$.noop();

})(jQuery);
*/
@@ -6,6 +6,7 @@
module("sortable: events");

test("start", function() {
expect( 7 );

var hash;
$("#sortable")
@@ -15,15 +16,18 @@ test("start", function() {
ok(hash, 'start event triggered');
ok(hash.helper, 'UI hash includes: helper');
ok(hash.placeholder, 'UI hash includes: placeholder');
ok(hash.position && (hash.position.top && hash.position.left), 'UI hash includes: position');
ok(hash.offset && (hash.offset.top && hash.offset.left), 'UI hash includes: offset');
ok(hash.item, 'UI hash includes: item');
ok(!hash.sender, 'UI hash does not include: sender');

// todo: see if these events should actually have sane values in them
ok('position' in hash, 'UI hash includes: position');
ok('offset' in hash, 'UI hash includes: offset');


});

test("sort", function() {
expect( 7 );

var hash;
$("#sortable")
@@ -33,14 +37,15 @@ test("sort", function() {
ok(hash, 'sort event triggered');
ok(hash.helper, 'UI hash includes: helper');
ok(hash.placeholder, 'UI hash includes: placeholder');
ok(hash.position && (hash.position.top && hash.position.left), 'UI hash includes: position');
ok(hash.position && ('top' in hash.position && 'left' in hash.position), 'UI hash includes: position');
ok(hash.offset && (hash.offset.top && hash.offset.left), 'UI hash includes: offset');
ok(hash.item, 'UI hash includes: item');
ok(!hash.sender, 'UI hash does not include: sender');

});

test("change", function() {
expect( 8 );

var hash;
$("#sortable")
@@ -51,19 +56,20 @@ test("change", function() {

$("#sortable")
.sortable({ change: function(e, ui) { hash = ui; } })
.find('li:eq(0)').simulate("drag", { dx: 0, dy: 20 });
.find('li:eq(0)').simulate("drag", { dx: 0, dy: 22 });

ok(hash, 'change event triggered');
ok(hash.helper, 'UI hash includes: helper');
ok(hash.placeholder, 'UI hash includes: placeholder');
ok(hash.position && (hash.position.top && hash.position.left), 'UI hash includes: position');
ok(hash.position && ('top' in hash.position && 'left' in hash.position), 'UI hash includes: position');
ok(hash.offset && (hash.offset.top && hash.offset.left), 'UI hash includes: offset');
ok(hash.item, 'UI hash includes: item');
ok(!hash.sender, 'UI hash does not include: sender');

});

test("beforeStop", function() {
expect( 7 );

var hash;
$("#sortable")
@@ -73,14 +79,15 @@ test("beforeStop", function() {
ok(hash, 'beforeStop event triggered');
ok(hash.helper, 'UI hash includes: helper');
ok(hash.placeholder, 'UI hash includes: placeholder');
ok(hash.position && (hash.position.top && hash.position.left), 'UI hash includes: position');
ok(hash.position && ('top' in hash.position && 'left' in hash.position), 'UI hash includes: position');
ok(hash.offset && (hash.offset.top && hash.offset.left), 'UI hash includes: offset');
ok(hash.item, 'UI hash includes: item');
ok(!hash.sender, 'UI hash does not include: sender');

});

test("stop", function() {
expect( 7 );

var hash;
$("#sortable")
@@ -90,14 +97,15 @@ test("stop", function() {
ok(hash, 'stop event triggered');
ok(!hash.helper, 'UI should not include: helper');
ok(hash.placeholder, 'UI hash includes: placeholder');
ok(hash.position && (hash.position.top && hash.position.left), 'UI hash includes: position');
ok(hash.position && ('top' in hash.position && 'left' in hash.position), 'UI hash includes: position');
ok(hash.offset && (hash.offset.top && hash.offset.left), 'UI hash includes: offset');
ok(hash.item, 'UI hash includes: item');
ok(!hash.sender, 'UI hash does not include: sender');

});

test("update", function() {
expect( 8 );

var hash;
$("#sortable")
@@ -108,18 +116,19 @@ test("update", function() {

$("#sortable")
.sortable({ update: function(e, ui) { hash = ui; } })
.find('li:eq(0)').simulate("drag", { dx: 0, dy: 20 });
.find('li:eq(0)').simulate("drag", { dx: 0, dy: 22 });

ok(hash, 'update event triggered');
ok(!hash.helper, 'UI hash should not include: helper');
ok(hash.placeholder, 'UI hash includes: placeholder');
ok(hash.position && (hash.position.top && hash.position.left), 'UI hash includes: position');
ok(hash.position && ('top' in hash.position && 'left' in hash.position), 'UI hash includes: position');
ok(hash.offset && (hash.offset.top && hash.offset.left), 'UI hash includes: offset');
ok(hash.item, 'UI hash includes: item');
ok(!hash.sender, 'UI hash does not include: sender');

});

/*
test("receive", function() {
ok(false, "missing test - untested code is broken code.");
});
@@ -143,5 +152,6 @@ test("activate", function() {
test("deactivate", function() {
ok(false, "missing test - untested code is broken code.");
});
*/

})(jQuery);
@@ -3,27 +3,10 @@
*/
(function($) {

var el, offsetBefore, offsetAfter, dragged;

function drag(handle, dx, dy) {
offsetBefore = $(handle).offset();
$(handle).simulate("drag", {
dx: dx || 0,
dy: dy || 0
});
dragged = { dx: dx, dy: dy };
offsetAfter = $(handle).offset();
}

function sort(handle, dx, dy, index, msg) {
drag(handle, dx, dy);
equal($(handle).parent().children().index(handle), index, msg);
}

module("sortable: methods");

test("init", function() {
expect(6);
expect(5);

$("<div></div>").appendTo('body').sortable().remove();
ok(true, '.sortable() called on element');
@@ -34,9 +17,6 @@ test("init", function() {
$("<div></div>").sortable();
ok(true, '.sortable() called on disconnected DOMElement');

$("<div></div>").sortable().sortable("foo");
ok(true, 'arbitrary method called after init');

$("<div></div>").sortable().sortable("option", "foo");
ok(true, 'arbitrary option getter after init');

@@ -45,6 +25,7 @@ test("init", function() {
});

test("destroy", function() {
expect(4);
$("<div></div>").appendTo('body').sortable().sortable("destroy").remove();
ok(true, '.sortable("destroy") called on element');

@@ -54,19 +35,19 @@ test("destroy", function() {
$("<div></div>").sortable().sortable("destroy");
ok(true, '.sortable("destroy") called on disconnected DOMElement');

$("<div></div>").sortable().sortable("destroy").sortable("foo");
ok(true, 'arbitrary method called after destroy');

var expected = $('<div></div>').sortable(),
actual = expected.sortable('destroy');
equal(actual, expected, 'destroy is chainable');
});

test("enable", function() {
expect(5);

var el, actual, expected;

el = $("#sortable").sortable({ disabled: true });

sort($("li", el)[0], 0, 40, 0, '.sortable({ disabled: true })');
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, '.sortable({ disabled: true })');

el.sortable("enable");
equal(el.sortable("option", "disabled"), false, "disabled option getter");
@@ -76,32 +57,35 @@ test("enable", function() {
el.sortable("option", "disabled", false);
equal(el.sortable("option", "disabled"), false, "disabled option setter");

sort($("li", el)[0], 0, 40, 2, '.sortable("option", "disabled", false)');
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, '.sortable("option", "disabled", false)');

var expected = $('<div></div>').sortable(),
actual = expected.sortable('enable');
expected = $('<div></div>').sortable(),
actual = expected.sortable('enable');
equal(actual, expected, 'enable is chainable');
});

test("disable", function() {
expect(7);

var el, actual, expected;

el = $("#sortable").sortable({ disabled: false });
sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })');
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, '.sortable({ disabled: false })');

el.sortable("disable");
sort($("li", el)[0], 0, 40, 0, 'disabled.sortable getter');
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, 'disabled.sortable getter');

el.sortable("destroy");

el.sortable({ disabled: false });
sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })');
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, '.sortable({ disabled: false })');
el.sortable("option", "disabled", true);
equal(el.sortable("option", "disabled"), true, "disabled option setter");
ok(el.sortable("widget").is(":not(.ui-state-disabled)"), "sortable element does not get ui-state-disabled since it's an interaction");
sort($("li", el)[0], 0, 40, 0, '.sortable("option", "disabled", true)');
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, '.sortable("option", "disabled", true)');

var expected = $('<div></div>').sortable(),
actual = expected.sortable('disable');
expected = $('<div></div>').sortable(),
actual = expected.sortable('disable');
equal(actual, expected, 'disable is chainable');
});

@@ -9,6 +9,7 @@ module("sortable: options");
// remove the parameter for when we finally implement
$.noop();

/*
test("{ appendTo: 'parent' }, default", function() {
ok(false, "missing test - untested code is broken code.");
});
@@ -256,5 +257,5 @@ test("{ zIndex: 1 }", function() {
test("{ zIndex: false }", function() {
ok(false, "missing test - untested code is broken code.");
});

*/
})(jQuery);
@@ -0,0 +1,9 @@
TestHelpers.sortable = {
sort: function(handle, dx, dy, index, msg) {
$(handle).simulate("drag", {
dx: dx || 0,
dy: dy || 0
});
equal($(handle).parent().children().index(handle), index, msg);
}
};
@@ -3,47 +3,33 @@
*/
(function($) {

var el, offsetBefore, offsetAfter, dragged;

function drag(handle, dx, dy) {
offsetBefore = $(handle).offset();
$(handle).simulate("drag", {
dx: dx || 0,
dy: dy || 0
});
dragged = { dx: dx, dy: dy };
offsetAfter = $(handle).offset();
}

function sort(handle, dx, dy, index, msg) {
drag(handle, dx, dy);
equal($(handle).parent().children().index(handle), index, msg);
}

module("sortable: tickets");

test("#3019: Stop fires too early", function() {
expect(2);

var helper = null;
el = $("#sortable").sortable({
stop: function(event, ui) {
helper = ui.helper;
}
});
var helper = null,
el = $("#sortable").sortable({
stop: function(event, ui) {
helper = ui.helper;
}
});

sort($("li", el)[0], 0, 40, 2, 'Dragging the sortable');
TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, 'Dragging the sortable');
equal(helper, null, "helper should be false");

});

test('#4752: link event firing on sortable with connect list', function () {
expect( 10 );

var fired = {},
hasFired = function (type) { return (type in fired) && (true === fired[type]); };

$('#sortable').clone().attr('id', 'sortable2').insertAfter('#sortable');

$('#main ul').sortable({
connectWith: '#main ul',
$('#qunit-fixture ul').sortable({
connectWith: '#qunit-fixture ul',
change: function () {
fired.change = true;
},
@@ -55,7 +41,7 @@ test('#4752: link event firing on sortable with connect list', function () {
}
});

$('#main ul li').live('click.ui-sortable-test', function () {
$('#qunit-fixture ul').bind('click.ui-sortable-test', function () {
fired.click = true;
});

@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Spinner Test Suite</title>

<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>

<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../qunit-composite.css">
@@ -3,7 +3,7 @@
var versions = [
"1.6", "1.6.1", "1.6.2", "1.6.3", "1.6.4",
"1.7", "1.7.1", "1.7.2",
"1.8.0", "1.8.1", "1.8.2",
"1.8.0", "1.8.1", "1.8.2", "1.8.3",
"git"
],
additionalTests = {
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Tabs Test Suite</title>

<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>

<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../qunit-composite.css">
@@ -33,7 +33,7 @@ test( "nested list", function() {
expect( 1 );

var element = $( "#tabs6" ).tabs();
equal( element.data( "tabs" ).anchors.length, 2, "should contain 2 tab" );
equal( element.data( "ui-tabs" ).anchors.length, 2, "should contain 2 tab" );
});

test( "disconnected from DOM", function() {
@@ -155,7 +155,7 @@ asyncTest( "keyboard support - LEFT, RIGHT, UP, DOWN, HOME, END, SPACE, ENTER",
panels = element.find( ".ui-tabs-panel" ),
keyCode = $.ui.keyCode;

element.data( "tabs" ).delay = 50;
element.data( "ui-tabs" ).delay = 50;

equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );
tabs.eq( 0 ).simulate( "focus" );
@@ -306,7 +306,7 @@ asyncTest( "keyboard support - CTRL navigation", function() {
panels = element.find( ".ui-tabs-panel" ),
keyCode = $.ui.keyCode;

element.data( "tabs" ).delay = 50;
element.data( "ui-tabs" ).delay = 50;

equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );
tabs.eq( 0 ).simulate( "focus" );
@@ -6,10 +6,13 @@ var disabled = TestHelpers.tabs.disabled,
module( "tabs: methods" );

test( "destroy", function() {
expect( 1 );
expect( 2 );
domEqual( "#tabs1", function() {
$( "#tabs1" ).tabs().tabs( "destroy" );
});
domEqual( "#tabs2", function() {
$( "#tabs2" ).tabs().tabs( "destroy" );
});
});

test( "enable", function() {
@@ -290,7 +290,7 @@ test( "hide and show: false", function() {
show: false,
hide: false
}),
widget = element.data( "tabs" ),
widget = element.data( "ui-tabs" ),
panels = element.find( ".ui-tabs-panel" );
widget._show = function() {
ok( false, "_show() called" );
@@ -311,7 +311,7 @@ asyncTest( "hide and show - animation", function() {
show: "drop",
hide: 2000
}),
widget = element.data( "tabs" ),
widget = element.data( "ui-tabs" ),
panels = element.find( ".ui-tabs-panel" );
widget._show = function( element, options, callback ) {
strictEqual( element[ 0 ], panels[ 1 ], "correct element in _show()" );
@@ -169,6 +169,14 @@ TestHelpers.commonWidgetTests = function( widget, settings ) {
});
};

/*
* Taken from https://github.com/jquery/qunit/tree/master/addons/close-enough
*/
window.closeEnough = function( actual, expected, maxDifference, message ) {
var passes = (actual === expected) || Math.abs(actual - expected) <= maxDifference;
QUnit.push(passes, actual, expected, message);
};

/*
* Experimental assertion for comparing DOM objects.
*
@@ -204,7 +212,34 @@ window.domEqual = function( selector, modifier, message ) {
"tabIndex",
"title"
];
/*
function getElementStyles( elem ) {
var key, len,
style = elem.ownerDocument.defaultView ?
elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
elem.currentStyle,
styles = {};
if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
len = style.length;
while ( len-- ) {
key = style[ len ];
if ( typeof style[ key ] === "string" ) {
styles[ $.camelCase( key ) ] = style[ key ];
}
}
// support: Opera, IE <9
} else {
for ( key in style ) {
if ( typeof style[ key ] === "string" ) {
styles[ key ] = style[ key ];
}
}
}
return styles;
}
*/
function extract( elem ) {
if ( !elem || !elem.length ) {
QUnit.push( false, actual, expected,
@@ -222,6 +257,8 @@ window.domEqual = function( selector, modifier, message ) {
var value = elem.attr( attr );
result[ attr ] = value !== undefined ? value : "";
});
// TODO: Enable when we can figure out what's happening with accordion
//result.style = getElementStyles( elem[ 0 ] );
result.events = $._data( elem[ 0 ], "events" );
result.data = $.extend( {}, elem.data() );
delete result.data[ $.expando ];
@@ -235,11 +272,22 @@ window.domEqual = function( selector, modifier, message ) {
}
return result;
}

function done() {
actual = extract( $( selector ) );
QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
}

// Get current state prior to modifier
expected = extract( $( selector ) );
modifier( $( selector ) );

actual = extract( $( selector ) );
QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
// Run modifier (async or sync), then compare state via done()
if ( modifier.length ) {
modifier( done );
} else {
modifier();
done();
}
};

}( jQuery ));
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Tooltip Test Suite</title>

<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>

<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../qunit-composite.css">
@@ -7,7 +7,7 @@ TestHelpers.commonWidgetTests( "tooltip", {
position: {
my: "left top+15",
at: "left bottom",
collision: "flipfit flipfit"
collision: "flipfit flip"
},
show: true,
tooltipClass: null,
@@ -94,4 +94,44 @@ test( "form containing an input with name title", function() {
equal( $( ".ui-tooltip" ).length, 0, "no tooltip for form" );
});

test( "tooltip on .ui-state-disabled element", function() {
expect( 2 );

var container = $( "#contains-tooltipped" ).tooltip(),
element = $( "#contained-tooltipped" ).addClass( "ui-state-disabled" );

element.trigger( "mouseover" );
equal( $( ".ui-tooltip" ).length, 1 );

container.empty();
equal( $( ".ui-tooltip" ).length, 0 );
});

// http://bugs.jqueryui.com/ticket/8740
asyncTest( "programmatic focus with async content", function() {
expect( 2 );
var element = $( "#tooltipped1" ).tooltip({
content: function( response ) {
setTimeout(function() {
response( "test" );
});
}
});

element.bind( "tooltipopen", function( event ) {
deepEqual( event.originalEvent.type, "focusin" );

element.bind( "tooltipclose", function( event ) {
deepEqual( event.originalEvent.type, "focusout" );
start();
});

setTimeout(function() {
element.blur();
});
});

element.focus();
});

}( jQuery ) );
@@ -146,4 +146,12 @@ test( "track + show delay", function() {
equal( $( ".ui-tooltip" ).css( "top" ), topVal + offsetVal + "px" );
});

test( "track and programmatic focus", function() {
expect( 1 );
$( "#qunit-fixture div input" ).tooltip({
track: true
}).focus();
equal( "inputtitle", $( ".ui-tooltip" ).text() );
});

}( jQuery ) );
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Widget Test Suite</title>

<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>

<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../qunit-composite.css">
@@ -4,6 +4,7 @@ module( "widget factory", {
teardown: function() {
if ( $.ui ) {
delete $.ui.testWidget;
delete $.fn.testWidget;
}
}
});
@@ -88,9 +89,9 @@ test( "custom selector expression", function() {
});

test( "jQuery usage", function() {
expect( 16 );
expect( 14 );

var elem, instance, ret, bcInstance,
var elem, instance, ret,
shouldCreate = false;

$.widget( "ui.testWidget", {
@@ -133,12 +134,6 @@ test( "jQuery usage", function() {
ret = elem.testWidget( "methodWithParams", "value1", "value2" );
equal( ret, elem, "jQuery object returned from method call" );

// 1.9 BC for #7810
// TODO remove
bcInstance = elem.data("testWidget");
equal( typeof bcInstance, "object", "instance stored in .data(pluginName)" );
equal( bcInstance.element[0], elem[0], "element stored on widget" );

ret = elem.testWidget( "getterSetterMethod" );
equal( ret, 5, "getter/setter can act as getter" );
ret = elem.testWidget( "getterSetterMethod", 30 );
@@ -331,8 +326,8 @@ test( "re-init", function() {
deepEqual( actions, [ "optionfoo", "init" ], "correct methods called on re-init with options" );
});

test( "inheritance - options", function() {
expect( 4 );
test( "inheritance", function() {
expect( 6 );
// #5830 - Widget: Using inheritance overwrites the base classes options
$.widget( "ui.testWidgetBase", {
options: {
@@ -353,13 +348,17 @@ test( "inheritance - options", function() {
}
});

equal( $.ui.testWidgetBase.prototype.widgetEventPrefix, "testWidgetBase",
"base class event prefix" );
deepEqual( $.ui.testWidgetBase.prototype.options.obj, {
key1: "foo",
key2: "bar"
}, "base class option object not overridden");
deepEqual( $.ui.testWidgetBase.prototype.options.arr, [ "testing" ],
"base class option array not overridden");

equal( $.ui.testWidgetExtension.prototype.widgetEventPrefix, "testWidgetExtension",
"extension class event prefix" );
deepEqual( $.ui.testWidgetExtension.prototype.options.obj, {
key1: "baz",
key2: "bar"
@@ -661,6 +660,46 @@ test( "._on() to element (default)", function() {
.trigger( "keydown" );
});

test( "._on() to element with suppressDisabledCheck", function() {
expect( 18 );
var that, widget;
$.widget( "ui.testWidget", {
_create: function() {
that = this;
this._on( true, {
keyup: this.keyup,
keydown: "keydown"
});
},
keyup: function( event ) {
equal( that, this );
equal( that.element[0], event.currentTarget );
equal( "keyup", event.type );
},
keydown: function( event ) {
equal( that, this );
equal( that.element[0], event.currentTarget );
equal( "keydown", event.type );
}
});
widget = $( "<div></div>" )
.testWidget()
.trigger( "keyup" )
.trigger( "keydown" );
widget
.testWidget( "disable" )
.trigger( "keyup" )
.trigger( "keydown" );
widget
.testWidget( "enable" )
.trigger( "keyup" )
.trigger( "keydown" );
widget
.testWidget( "destroy" )
.trigger( "keyup" )
.trigger( "keydown" );
});

test( "._on() to descendent", function() {
expect( 12 );
var that, widget, descendant;
@@ -796,7 +835,7 @@ test( "_on() to common element", function() {
ok( true, "handler triggered" );
}
});
var widget = $( "#widget" ).testWidget().data( "testWidget" );
var widget = $( "#widget" ).testWidget().data( "ui-testWidget" );
$( "#widget-wrapper" ).testWidget();
widget.destroy();
$( document ).trigger( "customevent" );
@@ -808,7 +847,7 @@ test( "_off() - single event", function() {
$.widget( "ui.testWidget", {} );
var shouldTriggerWidget, shouldTriggerOther,
element = $( "#widget" ),
widget = element.testWidget().data( "testWidget" );
widget = element.testWidget().data( "ui-testWidget" );
widget._on( element, { foo: function() {
ok( shouldTriggerWidget, "foo called from _on" );
}});
@@ -829,7 +868,7 @@ test( "_off() - multiple events", function() {
$.widget( "ui.testWidget", {} );
var shouldTriggerWidget, shouldTriggerOther,
element = $( "#widget" ),
widget = element.testWidget().data( "testWidget" );
widget = element.testWidget().data( "ui-testWidget" );
widget._on( element, {
foo: function() {
ok( shouldTriggerWidget, "foo called from _on" );
@@ -857,7 +896,7 @@ test( "_off() - all events", function() {
$.widget( "ui.testWidget", {} );
var shouldTriggerWidget, shouldTriggerOther,
element = $( "#widget" ),
widget = element.testWidget().data( "testWidget" );
widget = element.testWidget().data( "ui-testWidget" );
widget._on( element, {
foo: function() {
ok( shouldTriggerWidget, "foo called from _on" );
@@ -1162,6 +1201,12 @@ test( "._trigger() - instance as element", function() {
});
});

test( "auto-destroy - .remove() when disabled", function() {
shouldDestroy( true, function() {
$( "#widget" ).testWidget({ disabled: true }).remove();
});
});

test( "auto-destroy - .remove() on parent", function() {
shouldDestroy( true, function() {
$( "#widget" ).testWidget().parent().remove();
@@ -1305,4 +1350,56 @@ asyncTest( "_delay", function() {
$( "#widget" ).testWidget();
});

test( "$.widget.bridge()", function() {
expect( 9 );

var instance, ret,
elem = $( "<div>" );

function TestWidget( options, element ) {
deepEqual( options, { foo: "bar" }, "options passed" );
strictEqual( element, elem[ 0 ], "element passed" );
}

$.extend( TestWidget.prototype, {
method: function( param ) {
ok( true, "method called via .pluginName(methodName)" );
equal( param, "value1",
"parameter passed via .pluginName(methodName, param)" );
},
getter: function() {
return "qux";
}
});

$.widget.bridge( "testWidget", TestWidget );

ok( $.isFunction( $.fn.testWidget ), "jQuery plugin was created" );

strictEqual( elem.testWidget({ foo: "bar" }), elem, "plugin returns original jQuery object" );
instance = elem.data( "testWidget" );
equal( typeof instance, "object", "instance stored in .data(pluginName)" );

ret = elem.testWidget( "method", "value1" );
equal( ret, elem, "jQuery object returned from method call" );

ret = elem.testWidget( "getter" );
equal( ret, "qux", "getter returns value" );
});

test( "$.widget.bridge() - widgetFullName", function() {
expect( 1 );

var instance,
elem = $( "<div>" );

function TestWidget() {}
TestWidget.prototype.widgetFullName = "custom-widget";
$.widget.bridge( "testWidget", TestWidget );

elem.testWidget();
instance = elem.data( "custom-widget" );
equal( typeof instance, "object", "instance stored in .data(widgetFullName)" );
});

}( jQuery ) );
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>Accordion Visual Test</title>
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.accordion.js"></script>
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>addClass Visual Test : Queue</title>
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.effect.js"></script>
<style>
.box {
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>Button Visual Test</title>
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.button.js"></script>
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>Button Visual Test: Initialization Performance</title>
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.button.js"></script>
@@ -5,7 +5,7 @@
<title>Compound Visual Test : Accordion in Tabs</title>
<link rel="stylesheet" href="../visual.css">
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.accordion.js"></script>
@@ -5,7 +5,7 @@
<title>Compound Visual Test : Datepicker in Dialog</title>
<link rel="stylesheet" href="../visual.css">
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.mouse.js"></script>
@@ -5,7 +5,7 @@
<title>Compound Visual Test : All Widgets in Dialog</title>
<link rel="stylesheet" href="../visual.css">
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.mouse.js"></script>
@@ -5,7 +5,7 @@
<title>Compound Visual Test : Draggable in Accordion</title>
<link rel="stylesheet" href="../visual.css">
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.mouse.js"></script>
@@ -5,7 +5,7 @@
<title>Compound Visual Test : Draggable in Accordion</title>
<link rel="stylesheet" href="../visual.css">
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.mouse.js"></script>
@@ -5,7 +5,7 @@
<title>Compound Visual Test : Accordion in Tabs</title>
<link rel="stylesheet" href="../visual.css">
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.mouse.js"></script>
@@ -5,7 +5,7 @@
<title>Compound Visual Test : Tabs in Tabs</title>
<link rel="stylesheet" href="../visual.css">
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.accordion.js"></script>
@@ -5,7 +5,7 @@
<title>Compound Visual Test : Tabs in Tabs</title>
<link rel="stylesheet" href="../visual.css">
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.position.js"></script>
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>Dialog Visual Test</title>
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.mouse.js"></script>
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>Dialog Visual Test</title>
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.mouse.js"></script>
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>Dialog Visual Test</title>
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.mouse.js"></script>
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>Dialog Visual Test - Modal Dialog in Large DOM</title>
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.position.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Effects Test Suite</title>
<link rel="stylesheet" href="effects.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.effect.js"></script>
<script src="../../../ui/jquery.ui.effect-blind.js"></script>
<script src="../../../ui/jquery.ui.effect-bounce.js"></script>
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Effects Test Suite</title>
<link rel="stylesheet" href="effects.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.effect.js"></script>
<script src="../../../ui/jquery.ui.effect-scale.js"></script>
<script>
@@ -7,7 +7,7 @@
<link rel="stylesheet" href="../../themes/base/jquery.ui.core.css">
<link rel="stylesheet" href="../../themes/base/jquery.ui.theme.css">
<link rel="stylesheet" href="../index.css">
<script src="../jquery-1.8.2.js"></script>
<script src="../jquery-1.8.3.js"></script>
<script src="../index.js"></script>
</head>
<body>
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>Menu Visual Test: Default</title>
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.position.js"></script>
@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Position Visual Test</title>
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.mouse.js"></script>
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>Position Visual Test: Feedback</title>
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.position.js"></script>
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Example Page</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css" type="text/css">
<script type="text/javascript" src="../../jquery-1.8.2.js"></script>
<script type="text/javascript" src="../../jquery-1.8.3.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>Tooltip Visual Test: Animations</title>
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.position.js"></script>
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>Tooltip Visual Test: Default</title>
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.8.2.js"></script>
<script src="../../../jquery-1.8.3.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.position.js"></script>
@@ -12,7 +12,7 @@
/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
.ui-helper-hidden-accessible { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
.ui-helper-clearfix:after { clear: both; }
@@ -8,7 +8,7 @@
*
* http://docs.jquery.com/UI/Dialog#theming
*/
.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; outline: 0; }
.ui-dialog { position: absolute; top: 0; left: 0; padding: .2em; width: 300px; overflow: hidden; outline: 0; }
.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
@@ -47,7 +47,7 @@
----------------------------------*/

/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; background-position: 16px 16px; }
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; }
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }
@@ -245,4 +245,4 @@

/* Overlays */
.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; }
.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; }
@@ -15,7 +15,7 @@ jQuery(function($){
dayNamesMin: ['Su','Má','Tý','Mi','Hó','Fr','Le'],
weekHeader: 'Vk',
dateFormat: 'dd-mm-yy',
firstDay: 0,
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
@@ -0,0 +1,24 @@
/* Kyrgyz (UTF-8) initialisation for the jQuery UI date picker plugin. */
/* Written by Sergey Kartashov (ebishkek@yandex.ru). */
jQuery(function($){
$.datepicker.regional['ky'] = {
closeText: 'Жабуу',
prevText: '&#x3c;Мур',
nextText: 'Кий&#x3e;',
currentText: 'Бүгүн',
monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
'Июл','Авг','Сен','Окт','Ноя','Дек'],
dayNames: ['жекшемби', 'дүйшөмбү', 'шейшемби', 'шаршемби', 'бейшемби', 'жума', 'ишемби'],
dayNamesShort: ['жек', 'дүй', 'шей', 'шар', 'бей', 'жум', 'ише'],
dayNamesMin: ['Жк','Дш','Шш','Шр','Бш','Жм','Иш'],
weekHeader: 'Жум',
dateFormat: 'dd.mm.yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''
};
$.datepicker.setDefaults($.datepicker.regional['ky']);
});
@@ -43,95 +43,23 @@ $.widget( "ui.accordion", {
},

_create: function() {
var accordionId = this.accordionId = "ui-accordion-" +
(this.element.attr( "id" ) || ++uid),
options = this.options;

var options = this.options;
this.prevShow = this.prevHide = $();
this.element.addClass( "ui-accordion ui-widget ui-helper-reset" );

this.headers = this.element.find( options.header )
.addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" );
this._hoverable( this.headers );
this._focusable( this.headers );

this.headers.next()
.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
.hide();
this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
// ARIA
.attr( "role", "tablist" );

// don't allow collapsible: false and active: false / null
if ( !options.collapsible && (options.active === false || options.active == null) ) {
options.active = 0;
}

this._processPanels();
// handle negative values
if ( options.active < 0 ) {
options.active += this.headers.length;
}
this.active = this._findActive( options.active )
.addClass( "ui-accordion-header-active ui-state-active" )
.toggleClass( "ui-corner-all ui-corner-top" );
this.active.next()
.addClass( "ui-accordion-content-active" )
.show();

this._createIcons();
this.refresh();

// ARIA
this.element.attr( "role", "tablist" );

this.headers
.attr( "role", "tab" )
.each(function( i ) {
var header = $( this ),
headerId = header.attr( "id" ),
panel = header.next(),
panelId = panel.attr( "id" );
if ( !headerId ) {
headerId = accordionId + "-header-" + i;
header.attr( "id", headerId );
}
if ( !panelId ) {
panelId = accordionId + "-panel-" + i;
panel.attr( "id", panelId );
}
header.attr( "aria-controls", panelId );
panel.attr( "aria-labelledby", headerId );
})
.next()
.attr( "role", "tabpanel" );

this.headers
.not( this.active )
.attr({
"aria-selected": "false",
tabIndex: -1
})
.next()
.attr({
"aria-expanded": "false",
"aria-hidden": "true"
})
.hide();

// make sure at least one header is in the tab order
if ( !this.active.length ) {
this.headers.eq( 0 ).attr( "tabIndex", 0 );
} else {
this.active.attr({
"aria-selected": "true",
tabIndex: 0
})
.next()
.attr({
"aria-expanded": "true",
"aria-hidden": "false"
});
}

this._on( this.headers, { keydown: "_keydown" });
this._on( this.headers.next(), { keydown: "_panelKeyDown" });
this._setupEvents( options.event );
this._refresh();
},

_getCreateEventData: function() {
@@ -283,9 +211,114 @@ $.widget( "ui.accordion", {
},

refresh: function() {
var options = this.options;
this._processPanels();

// was collapsed or no panel
if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) {
options.active = false;
this.active = $();
// active false only when collapsible is true
} if ( options.active === false ) {
this._activate( 0 );
// was active, but active panel is gone
} else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
// all remaining panel are disabled
if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) {
options.active = false;
this.active = $();
// activate previous panel
} else {
this._activate( Math.max( 0, options.active - 1 ) );
}
// was active, active panel still exists
} else {
// make sure active index is correct
options.active = this.headers.index( this.active );
}

this._destroyIcons();

this._refresh();
},

_processPanels: function() {
this.headers = this.element.find( this.options.header )
.addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" );

this.headers.next()
.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
.filter(":not(.ui-accordion-content-active)")
.hide();
},

_refresh: function() {
var maxHeight,
heightStyle = this.options.heightStyle,
parent = this.element.parent();
options = this.options,
heightStyle = options.heightStyle,
parent = this.element.parent(),
accordionId = this.accordionId = "ui-accordion-" +
(this.element.attr( "id" ) || ++uid);

this.active = this._findActive( options.active )
.addClass( "ui-accordion-header-active ui-state-active" )
.toggleClass( "ui-corner-all ui-corner-top" );
this.active.next()
.addClass( "ui-accordion-content-active" )
.show();

this.headers
.attr( "role", "tab" )
.each(function( i ) {
var header = $( this ),
headerId = header.attr( "id" ),
panel = header.next(),
panelId = panel.attr( "id" );
if ( !headerId ) {
headerId = accordionId + "-header-" + i;
header.attr( "id", headerId );
}
if ( !panelId ) {
panelId = accordionId + "-panel-" + i;
panel.attr( "id", panelId );
}
header.attr( "aria-controls", panelId );
panel.attr( "aria-labelledby", headerId );
})
.next()
.attr( "role", "tabpanel" );

this.headers
.not( this.active )
.attr({
"aria-selected": "false",
tabIndex: -1
})
.next()
.attr({
"aria-expanded": "false",
"aria-hidden": "true"
})
.hide();

// make sure at least one header is in the tab order
if ( !this.active.length ) {
this.headers.eq( 0 ).attr( "tabIndex", 0 );
} else {
this.active.attr({
"aria-selected": "true",
tabIndex: 0
})
.next()
.attr({
"aria-expanded": "true",
"aria-hidden": "false"
});
}

this._createIcons();

this._setupEvents( options.event );

if ( heightStyle === "fill" ) {
maxHeight = parent.height();
@@ -313,7 +346,7 @@ $.widget( "ui.accordion", {
maxHeight = 0;
this.headers.next()
.each(function() {
maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
})
.height( maxHeight );
}
@@ -342,14 +375,20 @@ $.widget( "ui.accordion", {
},

_setupEvents: function( event ) {
var events = {};
if ( !event ) {
return;
var events = {
keydown: "_keydown"
};
if ( event ) {
$.each( event.split(" "), function( index, eventName ) {
events[ eventName ] = "_eventHandler";
});
}
$.each( event.split(" "), function( index, eventName ) {
events[ eventName ] = "_eventHandler";
});

this._off( this.headers.add( this.headers.next() ) );
this._on( this.headers, events );
this._on( this.headers.next(), { keydown: "_panelKeyDown" });
this._hoverable( this.headers );
this._focusable( this.headers );
},

_eventHandler: function( event ) {
@@ -190,7 +190,7 @@ $.widget( "ui.autocomplete", {
})
.zIndex( this.element.zIndex() + 1 )
.hide()
.data( "menu" );
.data( "ui-menu" );

this._on( this.menu.element, {
mousedown: function( event ) {
@@ -70,21 +70,22 @@ $.widget( "ui.button", {
var that = this,
options = this.options,
toggleButton = this.type === "checkbox" || this.type === "radio",
hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
activeClass = !toggleButton ? "ui-state-active" : "",
focusClass = "ui-state-focus";

if ( options.label === null ) {
options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
}

this._hoverable( this.buttonElement );

this.buttonElement
.addClass( baseClasses )
.attr( "role", "button" )
.bind( "mouseenter" + this.eventNamespace, function() {
if ( options.disabled ) {
return;
}
$( this ).addClass( "ui-state-hover" );
if ( this === lastActive ) {
$( this ).addClass( "ui-state-active" );
}
@@ -93,7 +94,7 @@ $.widget( "ui.button", {
if ( options.disabled ) {
return;
}
$( this ).removeClass( hoverClass );
$( this ).removeClass( activeClass );
})
.bind( "click" + this.eventNamespace, function( event ) {
if ( options.disabled ) {
@@ -358,7 +359,7 @@ $.widget( "ui.button", {
$.widget( "ui.buttonset", {
version: "@VERSION",
options: {
items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(button)"
items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
},

_create: function() {
@@ -128,53 +128,6 @@ $.fn.extend({
}
});

// support: jQuery <1.8
if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
$.each( [ "Width", "Height" ], function( i, name ) {
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
type = name.toLowerCase(),
orig = {
innerWidth: $.fn.innerWidth,
innerHeight: $.fn.innerHeight,
outerWidth: $.fn.outerWidth,
outerHeight: $.fn.outerHeight
};

function reduce( elem, size, border, margin ) {
$.each( side, function() {
size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
if ( border ) {
size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( margin ) {
size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
}
});
return size;
}

$.fn[ "inner" + name ] = function( size ) {
if ( size === undefined ) {
return orig[ "inner" + name ].call( this );
}

return this.each(function() {
$( this ).css( type, reduce( this, size ) + "px" );
});
};

$.fn[ "outer" + name] = function( size, margin ) {
if ( typeof size !== "number" ) {
return orig[ "outer" + name ].call( this, size );
}

return this.each(function() {
$( this).css( type, reduce( this, size, true, margin ) + "px" );
});
};
});
}

// selectors
function focusable( element, isTabIndexNotNaN ) {
var map, mapName, img,
@@ -230,16 +183,72 @@ $.extend( $.expr[ ":" ], {
// support
$.support.selectstart = "onselectstart" in document.createElement( "div" );

// support: jQuery <1.8
if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
$.each( [ "Width", "Height" ], function( i, name ) {
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
type = name.toLowerCase(),
orig = {
innerWidth: $.fn.innerWidth,
innerHeight: $.fn.innerHeight,
outerWidth: $.fn.outerWidth,
outerHeight: $.fn.outerHeight
};

function reduce( elem, size, border, margin ) {
$.each( side, function() {
size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
if ( border ) {
size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( margin ) {
size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
}
});
return size;
}

$.fn[ "inner" + name ] = function( size ) {
if ( size === undefined ) {
return orig[ "inner" + name ].call( this );
}

return this.each(function() {
$( this ).css( type, reduce( this, size ) + "px" );
});
};

$.fn[ "outer" + name] = function( size, margin ) {
if ( typeof size !== "number" ) {
return orig[ "outer" + name ].call( this, size );
}

return this.each(function() {
$( this).css( type, reduce( this, size, true, margin ) + "px" );
});
};
});
}

// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
$.fn.removeData = (function( removeData ) {
return function( key ) {
if ( arguments.length ) {
return removeData.call( this, $.camelCase( key ) );
} else {
return removeData.call( this );
}
};
})( $.fn.removeData );
}


// deprecated

(function() {
var uaMatch = /msie ([\w.]+)/.exec( navigator.userAgent.toLowerCase() ) || [];
$.ui.ie = uaMatch.length ? true : false;
})();


// deprecated
$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );

$.fn.extend({
disableSelection: function() {

Large diffs are not rendered by default.

@@ -334,15 +334,18 @@ $.widget("ui.dialog", {
}
if ( hasButtons ) {
$.each( buttons, function( name, props ) {
var button, click;
props = $.isFunction( props ) ?
{ click: props, text: name } :
props;
var button = $( "<button type='button'></button>" )
.attr( props, true )
.unbind( "click" )
.click(function() {
props.click.apply( that.element[0], arguments );
})
// Default to a non-submitting button
props = $.extend( { type: "button" }, props );
// Change the context for the click callback to be the main element
click = props.click;
props.click = function() {
click.apply( that.element[0], arguments );
};
button = $( "<button></button>", props )
.appendTo( that.uiButtonSet );
if ( $.fn.button ) {
button.button();
@@ -513,7 +516,7 @@ $.widget("ui.dialog", {
if ( resize ) {
this._size();
}
if ( this.uiDialog.is( ":data(resizable)" ) ) {
if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
this.uiDialog.resizable( "option", resizableOptions );
}
},
@@ -543,7 +546,7 @@ $.widget("ui.dialog", {
}
break;
case "draggable":
isDraggable = uiDialog.is( ":data(draggable)" );
isDraggable = uiDialog.is( ":data(ui-draggable)" );
if ( isDraggable && !value ) {
uiDialog.draggable( "destroy" );
}
@@ -557,7 +560,7 @@ $.widget("ui.dialog", {
break;
case "resizable":
// currently resizable, becoming non-resizable
isResizable = uiDialog.is( ":data(resizable)" );
isResizable = uiDialog.is( ":data(ui-resizable)" );
if ( isResizable && !value ) {
uiDialog.resizable( "destroy" );
}
@@ -618,7 +621,7 @@ $.widget("ui.dialog", {
this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
}

if (this.uiDialog.is( ":data(resizable)" ) ) {
if (this.uiDialog.is( ":data(ui-resizable)" ) ) {
this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
}
}
@@ -506,11 +506,11 @@ $.widget("ui.draggable", $.ui.mouse, {
$.ui.plugin.add("draggable", "connectToSortable", {
start: function(event, ui) {

var inst = $(this).data("draggable"), o = inst.options,
var inst = $(this).data("ui-draggable"), o = inst.options,
uiSortable = $.extend({}, ui, { item: inst.element });
inst.sortables = [];
$(o.connectToSortable).each(function() {
var sortable = $.data(this, 'sortable');
var sortable = $.data(this, 'ui-sortable');
if (sortable && !sortable.options.disabled) {
inst.sortables.push({
instance: sortable,
@@ -525,7 +525,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
stop: function(event, ui) {

//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
var inst = $(this).data("draggable"),
var inst = $(this).data("ui-draggable"),
uiSortable = $.extend({}, ui, { item: inst.element });

$.each(inst.sortables, function() {
@@ -558,7 +558,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
},
drag: function(event, ui) {

var inst = $(this).data("draggable"), that = this;
var inst = $(this).data("ui-draggable"), that = this;

$.each(inst.sortables, function() {

@@ -592,7 +592,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
//Now we fake the start of dragging for the sortable instance,
//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("ui-sortable-item", true);
this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
this.instance.options.helper = function() { return ui.helper[0]; };

@@ -652,36 +652,36 @@ $.ui.plugin.add("draggable", "connectToSortable", {

$.ui.plugin.add("draggable", "cursor", {
start: function() {
var t = $('body'), o = $(this).data('draggable').options;
var t = $('body'), o = $(this).data('ui-draggable').options;
if (t.css("cursor")) o._cursor = t.css("cursor");
t.css("cursor", o.cursor);
},
stop: function() {
var o = $(this).data('draggable').options;
var o = $(this).data('ui-draggable').options;
if (o._cursor) $('body').css("cursor", o._cursor);
}
});

$.ui.plugin.add("draggable", "opacity", {
start: function(event, ui) {
var t = $(ui.helper), o = $(this).data('draggable').options;
var t = $(ui.helper), o = $(this).data('ui-draggable').options;
if(t.css("opacity")) o._opacity = t.css("opacity");
t.css('opacity', o.opacity);
},
stop: function(event, ui) {
var o = $(this).data('draggable').options;
var o = $(this).data('ui-draggable').options;
if(o._opacity) $(ui.helper).css('opacity', o._opacity);
}
});

$.ui.plugin.add("draggable", "scroll", {
start: function() {
var i = $(this).data("draggable");
var i = $(this).data("ui-draggable");
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
},
drag: function( event ) {

var i = $(this).data("draggable"), o = i.options, scrolled = false;
var i = $(this).data("ui-draggable"), o = i.options, scrolled = false;

if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {

@@ -726,10 +726,10 @@ $.ui.plugin.add("draggable", "scroll", {
$.ui.plugin.add("draggable", "snap", {
start: function() {

var i = $(this).data("draggable"), o = i.options;
var i = $(this).data("ui-draggable"), o = i.options;
i.snapElements = [];

$(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
$(o.snap.constructor != String ? ( o.snap.items || ':data(ui-draggable)' ) : o.snap).each(function() {
var $t = $(this); var $o = $t.offset();
if(this != i.element[0]) i.snapElements.push({
item: this,
@@ -741,7 +741,7 @@ $.ui.plugin.add("draggable", "snap", {
},
drag: function(event, ui) {

var inst = $(this).data("draggable"), o = inst.options;
var inst = $(this).data("ui-draggable"), o = inst.options;
var d = o.snapTolerance;

var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
@@ -795,7 +795,7 @@ $.ui.plugin.add("draggable", "snap", {
$.ui.plugin.add("draggable", "stack", {
start: function() {

var o = $(this).data("draggable").options;
var o = $(this).data("ui-draggable").options;

var group = $.makeArray($(o.stack)).sort(function(a,b) {
return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
@@ -814,12 +814,12 @@ $.ui.plugin.add("draggable", "stack", {

$.ui.plugin.add("draggable", "zIndex", {
start: function(event, ui) {
var t = $(ui.helper), o = $(this).data("draggable").options;
var t = $(ui.helper), o = $(this).data("ui-draggable").options;
if(t.css("zIndex")) o._zIndex = t.css("zIndex");
t.css('zIndex', o.zIndex);
},
stop: function(event, ui) {
var o = $(this).data("draggable").options;
var o = $(this).data("ui-draggable").options;
if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
}
});
@@ -16,7 +16,6 @@
*/
(function( $, undefined ) {

/*jshint onevar: false, curly: false, eqeqeq: false, laxbreak: true */
$.widget("ui.droppable", {
version: "@VERSION",
widgetEventPrefix: "drop",
@@ -31,8 +30,11 @@ $.widget("ui.droppable", {
},
_create: function() {

var o = this.options, accept = o.accept;
this.isover = 0; this.isout = 1;
var o = this.options,
accept = o.accept;

this.isover = false;
this.isout = true;

this.accept = $.isFunction(accept) ? accept : function(d) {
return d.is(accept);
@@ -50,17 +52,21 @@ $.widget("ui.droppable", {
},

_destroy: function() {
var drop = $.ui.ddmanager.droppables[this.options.scope];
for ( var i = 0; i < drop.length; i++ )
if ( drop[i] == this )
var i = 0,
drop = $.ui.ddmanager.droppables[this.options.scope];

for ( ; i < drop.length; i++ ) {
if ( drop[i] === this ) {
drop.splice(i, 1);
}
}

this.element.removeClass("ui-droppable ui-droppable-disabled");
},

_setOption: function(key, value) {

if(key == 'accept') {
if(key === 'accept') {
this.accept = $.isFunction(value) ? value : function(d) {
return d.is(value);
};
@@ -70,23 +76,37 @@ $.widget("ui.droppable", {

_activate: function(event) {
var draggable = $.ui.ddmanager.current;
if(this.options.activeClass) this.element.addClass(this.options.activeClass);
(draggable && this._trigger('activate', event, this.ui(draggable)));
if(this.options.activeClass) {
this.element.addClass(this.options.activeClass);
}
if(draggable){
this._trigger('activate', event, this.ui(draggable));
}
},

_deactivate: function(event) {
var draggable = $.ui.ddmanager.current;
if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
(draggable && this._trigger('deactivate', event, this.ui(draggable)));
if(this.options.activeClass) {
this.element.removeClass(this.options.activeClass);
}
if(draggable){
this._trigger('deactivate', event, this.ui(draggable));
}
},

_over: function(event) {

var draggable = $.ui.ddmanager.current;
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element

// Bail if draggable and droppable are same element
if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
return;
}

if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
if(this.options.hoverClass) {
this.element.addClass(this.options.hoverClass);
}
this._trigger('over', event, this.ui(draggable));
}

@@ -95,36 +115,52 @@ $.widget("ui.droppable", {
_out: function(event) {

var draggable = $.ui.ddmanager.current;
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element

// Bail if draggable and droppable are same element
if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
return;
}

if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
if(this.options.hoverClass) {
this.element.removeClass(this.options.hoverClass);
}
this._trigger('out', event, this.ui(draggable));
}

},

_drop: function(event,custom) {

var draggable = custom || $.ui.ddmanager.current;
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
var draggable = custom || $.ui.ddmanager.current,
childrenIntersection = false;

var childrenIntersection = false;
this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
var inst = $.data(this, 'droppable');
// Bail if draggable and droppable are same element
if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
return false;
}

this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() {
var inst = $.data(this, 'ui-droppable');
if(
inst.options.greedy
&& !inst.options.disabled
&& inst.options.scope == draggable.options.scope
&& inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
&& $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
inst.options.greedy &&
!inst.options.disabled &&
inst.options.scope === draggable.options.scope &&
inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) &&
$.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
) { childrenIntersection = true; return false; }
});
if(childrenIntersection) return false;
if(childrenIntersection) {
return false;
}

if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
if(this.options.activeClass) {
this.element.removeClass(this.options.activeClass);
}
if(this.options.hoverClass) {
this.element.removeClass(this.options.hoverClass);
}
this._trigger('drop', event, this.ui(draggable));
return this.element;
}
@@ -146,27 +182,28 @@ $.widget("ui.droppable", {

$.ui.intersect = function(draggable, droppable, toleranceMode) {

if (!droppable.offset) return false;
if (!droppable.offset) {
return false;
}

var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
var l = droppable.offset.left, r = l + droppable.proportions.width,
var draggableLeft, draggableTop,
x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height,
l = droppable.offset.left, r = l + droppable.proportions.width,
t = droppable.offset.top, b = t + droppable.proportions.height;

switch (toleranceMode) {
case 'fit':
return (l <= x1 && x2 <= r
&& t <= y1 && y2 <= b);
return (l <= x1 && x2 <= r && t <= y1 && y2 <= b);
case 'intersect':
return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
&& x2 - (draggable.helperProportions.width / 2) < r // Left Half
&& t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
&& y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half
x2 - (draggable.helperProportions.width / 2) < r && // Left Half
t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half
y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
case 'pointer':
var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
return isOver;
draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left);
draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top);
return $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
case 'touch':
return (
(y1 >= t && y1 <= b) || // Top edge touching
@@ -191,23 +228,35 @@ $.ui.ddmanager = {
droppables: { 'default': [] },
prepareOffsets: function(t, event) {

var m = $.ui.ddmanager.droppables[t.options.scope] || [];
var type = event ? event.type : null; // workaround for #2317
var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
var i, j,
m = $.ui.ddmanager.droppables[t.options.scope] || [],
type = event ? event.type : null, // workaround for #2317
list = (t.currentItem || t.element).find(":data(ui-droppable)").andSelf();

droppablesLoop: for (var i = 0; i < m.length; i++) {
droppablesLoop: for (i = 0; i < m.length; i++) {

//No disabled and non-accepted
if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) {
continue;
}

if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
// Filter out elements in the current dragged item
for (var j=0; j < list.length; j++) {
if(list[j] == m[i].element[0]) {
for (j=0; j < list.length; j++) {
if(list[j] === m[i].element[0]) {
m[i].proportions.height = 0;
continue droppablesLoop;
}
}
m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue

if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
m[i].visible = m[i].element.css("display") !== "none";
if(!m[i].visible) {
continue;
}

//Activate the droppable if used directly from draggables
if(type === "mousedown") {
m[i]._activate.call(m[i], event);
}

m[i].offset = m[i].element.offset();
m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
@@ -220,12 +269,16 @@ $.ui.ddmanager = {
var dropped = false;
$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {

if(!this.options) return;
if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
if(!this.options) {
return;
}
if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) {
dropped = this._drop.call(this, event) || dropped;
}

if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
this.isout = 1; this.isover = 0;
this.isout = true;
this.isover = false;
this._deactivate.call(this, event);
}

@@ -236,51 +289,60 @@ $.ui.ddmanager = {
dragStart: function( draggable, event ) {
//Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
if( !draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
});
},
drag: function(draggable, event) {

//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
if(draggable.options.refreshPositions) {
$.ui.ddmanager.prepareOffsets(draggable, event);
}

//Run through all droppables and check their positions based on specific tolerance options
$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {

if(this.options.disabled || this.greedyChild || !this.visible) return;
var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
if(this.options.disabled || this.greedyChild || !this.visible) {
return;
}

var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover === 0 ? 'isover' : null);
if(!c) return;
var parentInstance, scope, parent,
intersects = $.ui.intersect(draggable, this, this.options.tolerance),
c = !intersects && this.isover ? 'isout' : (intersects && !this.isover ? 'isover' : null);
if(!c) {
return;
}

var parentInstance;
if (this.options.greedy) {
// find droppable parents with same scope
var scope = this.options.scope;
var parent = this.element.parents(':data(droppable)').filter(function () {
return $.data(this, 'droppable').options.scope === scope;
scope = this.options.scope;
parent = this.element.parents(':data(ui-droppable)').filter(function () {
return $.data(this, 'ui-droppable').options.scope === scope;
});

if (parent.length) {
parentInstance = $.data(parent[0], 'droppable');
parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
parentInstance = $.data(parent[0], 'ui-droppable');
parentInstance.greedyChild = (c === 'isover');
}
}

// we just moved into a greedy child
if (parentInstance && c == 'isover') {
parentInstance.isover = 0;
parentInstance.isout = 1;
if (parentInstance && c === 'isover') {
parentInstance.isover = false;
parentInstance.isout = true;
parentInstance._out.call(parentInstance, event);
}

this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
this[c == "isover" ? "_over" : "_out"].call(this, event);
this[c] = true;
this[c === 'isout' ? 'isover' : 'isout'] = false;
this[c === "isover" ? "_over" : "_out"].call(this, event);

// we just moved out of a greedy child
if (parentInstance && c == 'isout') {
parentInstance.isout = 0;
parentInstance.isover = 1;
if (parentInstance && c === 'isout') {
parentInstance.isout = false;
parentInstance.isover = true;
parentInstance._over.call(parentInstance, event);
}
});
@@ -289,7 +351,9 @@ $.ui.ddmanager = {
dragStop: function( draggable, event ) {
draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
//Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
if( !draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
}
};