/instantMessage/node_modules/jquery-ui/tests/unit/sortable/events.js |
@@ -0,0 +1,380 @@ |
define( [ |
"qunit", |
"jquery", |
"./helper", |
"ui/widgets/sortable", |
"ui/widgets/draggable" |
], function( QUnit, $, testHelper ) { |
|
QUnit.module( "sortable: events" ); |
|
QUnit.test( "start", function( assert ) { |
assert.expect( 7 ); |
|
var hash; |
$( "#sortable" ).sortable( { |
start: function( e, ui ) { |
hash = ui; |
} |
} ).find( "li:eq(0)" ).simulate( "drag", { |
dy: 10 |
} ); |
|
assert.ok( hash, "start event triggered" ); |
assert.ok( hash.helper, "UI hash includes: helper" ); |
assert.ok( hash.placeholder, "UI hash includes: placeholder" ); |
assert.ok( hash.item, "UI hash includes: item" ); |
assert.ok( !hash.sender, "UI hash does not include: sender" ); |
|
// Todo: see if these events should actually have sane values in them |
assert.ok( "position" in hash, "UI hash includes: position" ); |
assert.ok( "offset" in hash, "UI hash includes: offset" ); |
} ); |
|
QUnit.test( "sort", function( assert ) { |
assert.expect( 7 ); |
|
var hash; |
$( "#sortable" ).sortable( { |
sort: function( e, ui ) { |
hash = ui; |
} |
} ).find( "li:eq(0)" ).simulate( "drag", { |
dy: 10 |
} ); |
|
assert.ok( hash, "sort event triggered" ); |
assert.ok( hash.helper, "UI hash includes: helper" ); |
assert.ok( hash.placeholder, "UI hash includes: placeholder" ); |
assert.ok( hash.position && ( "top" in hash.position && "left" in hash.position ), "UI hash includes: position" ); |
assert.ok( hash.offset && ( hash.offset.top && hash.offset.left ), "UI hash includes: offset" ); |
assert.ok( hash.item, "UI hash includes: item" ); |
assert.ok( !hash.sender, "UI hash does not include: sender" ); |
|
} ); |
|
QUnit.test( "change", function( assert ) { |
assert.expect( 8 ); |
|
var hash; |
$( "#sortable" ).sortable( { |
change: function( e, ui ) { |
hash = ui; |
} |
} ).find( "li:eq(0)" ).simulate( "drag", { |
dx: 1, |
dy: 1 |
} ); |
|
assert.ok( !hash, "1px drag, change event should not be triggered" ); |
|
$( "#sortable" ).sortable( { |
change: function( e, ui ) { |
hash = ui; |
} |
} ).find( "li:eq(0)" ).simulate( "drag", { |
dy: 22 |
} ); |
|
assert.ok( hash, "change event triggered" ); |
assert.ok( hash.helper, "UI hash includes: helper" ); |
assert.ok( hash.placeholder, "UI hash includes: placeholder" ); |
assert.ok( hash.position && ( "top" in hash.position && "left" in hash.position ), "UI hash includes: position" ); |
assert.ok( hash.offset && ( hash.offset.top && hash.offset.left ), "UI hash includes: offset" ); |
assert.ok( hash.item, "UI hash includes: item" ); |
assert.ok( !hash.sender, "UI hash does not include: sender" ); |
|
} ); |
|
QUnit.test( "beforeStop", function( assert ) { |
assert.expect( 7 ); |
|
var hash; |
$( "#sortable" ).sortable( { |
beforeStop: function( e, ui ) { |
hash = ui; |
} |
} ).find( "li:eq(0)" ).simulate( "drag", { |
dy: 20 |
} ); |
|
assert.ok( hash, "beforeStop event triggered" ); |
assert.ok( hash.helper, "UI hash includes: helper" ); |
assert.ok( hash.placeholder, "UI hash includes: placeholder" ); |
assert.ok( hash.position && ( "top" in hash.position && "left" in hash.position ), "UI hash includes: position" ); |
assert.ok( hash.offset && ( hash.offset.top && hash.offset.left ), "UI hash includes: offset" ); |
assert.ok( hash.item, "UI hash includes: item" ); |
assert.ok( !hash.sender, "UI hash does not include: sender" ); |
|
} ); |
|
QUnit.test( "stop", function( assert ) { |
assert.expect( 7 ); |
|
var hash; |
$( "#sortable" ).sortable( { |
stop: function( e, ui ) { |
hash = ui; |
} |
} ).find( "li:eq(0)" ).simulate( "drag", { |
dy: 20 |
} ); |
|
assert.ok( hash, "stop event triggered" ); |
assert.ok( !hash.helper, "UI should not include: helper" ); |
assert.ok( hash.placeholder, "UI hash includes: placeholder" ); |
assert.ok( hash.position && ( "top" in hash.position && "left" in hash.position ), "UI hash includes: position" ); |
assert.ok( hash.offset && ( hash.offset.top && hash.offset.left ), "UI hash includes: offset" ); |
assert.ok( hash.item, "UI hash includes: item" ); |
assert.ok( !hash.sender, "UI hash does not include: sender" ); |
|
} ); |
|
QUnit.test( "update", function( assert ) { |
assert.expect( 8 ); |
|
var hash; |
$( "#sortable" ).sortable( { |
update: function( e, ui ) { |
hash = ui; |
} |
} ).find( "li:eq(0)" ).simulate( "drag", { |
dx: 1, |
dy: 1 |
} ); |
|
assert.ok( !hash, "1px drag, update event should not be triggered" ); |
|
$( "#sortable" ).sortable( { |
update: function( e, ui ) { |
hash = ui; |
} |
} ).find( "li:eq(0)" ).simulate( "drag", { |
dy: 22 |
} ); |
|
assert.ok( hash, "update event triggered" ); |
assert.ok( !hash.helper, "UI hash should not include: helper" ); |
assert.ok( hash.placeholder, "UI hash includes: placeholder" ); |
assert.ok( hash.position && ( "top" in hash.position && "left" in hash.position ), "UI hash includes: position" ); |
assert.ok( hash.offset && ( hash.offset.top && hash.offset.left ), "UI hash includes: offset" ); |
assert.ok( hash.item, "UI hash includes: item" ); |
assert.ok( !hash.sender, "UI hash does not include: sender" ); |
|
} ); |
|
QUnit.test( "#3019: Stop fires too early", function( assert ) { |
assert.expect( 2 ); |
|
var helper = null, |
el = $( "#sortable" ).sortable( { |
stop: function( event, ui ) { |
helper = ui.helper; |
} |
} ); |
|
testHelper.sort( assert, $( "li", el )[ 0 ], 0, 44, 2, "Dragging the sortable" ); |
assert.equal( helper, null, "helper should be false" ); |
|
} ); |
|
QUnit.test( "#4752: link event firing on sortable with connect list", function( assert ) { |
assert.expect( 10 ); |
|
var fired = {}, |
hasFired = function( type ) { return ( type in fired ) && ( true === fired[ type ] ); }; |
|
$( "#sortable" ).clone().attr( "id", "sortable2" ).insertAfter( "#sortable" ); |
|
$( "#qunit-fixture ul" ).sortable( { |
connectWith: "#qunit-fixture ul", |
change: function() { |
fired.change = true; |
}, |
receive: function() { |
fired.receive = true; |
}, |
remove: function() { |
fired.remove = true; |
} |
} ); |
|
$( "#qunit-fixture ul" ).on( "click.ui-sortable-test", function() { |
fired.click = true; |
} ); |
|
$( "#sortable li:eq(0)" ).simulate( "click" ); |
assert.ok( !hasFired( "change" ), "Click only, change event should not have fired" ); |
assert.ok( hasFired( "click" ), "Click event should have fired" ); |
|
// Drag an item within the first list |
fired = {}; |
$( "#sortable li:eq(0)" ).simulate( "drag", { dx: 0, dy: 40 } ); |
assert.ok( hasFired( "change" ), "40px drag, change event should have fired" ); |
assert.ok( !hasFired( "receive" ), "Receive event should not have fired" ); |
assert.ok( !hasFired( "remove" ), "Remove event should not have fired" ); |
assert.ok( !hasFired( "click" ), "Click event should not have fired" ); |
|
// Drag an item from the first list to the second, connected list |
fired = {}; |
$( "#sortable li:eq(0)" ).simulate( "drag", { dx: 0, dy: 150 } ); |
assert.ok( hasFired( "change" ), "150px drag, change event should have fired" ); |
assert.ok( hasFired( "receive" ), "Receive event should have fired" ); |
assert.ok( hasFired( "remove" ), "Remove event should have fired" ); |
assert.ok( !hasFired( "click" ), "Click event should not have fired" ); |
} ); |
|
/* |
Test("receive", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("remove", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
*/ |
|
QUnit.test( "over", function( assert ) { |
assert.expect( 8 ); |
|
var hash, |
overCount = 0; |
|
$( "#sortable" ).sortable( { |
over: function( e, ui ) { |
hash = ui; |
overCount++; |
} |
} ).find( "li:eq(0)" ).simulate( "drag", { |
dy: 20 |
} ); |
|
assert.ok( hash, "over event triggered" ); |
assert.ok( hash.helper, "UI includes: helper" ); |
assert.ok( hash.placeholder, "UI hash includes: placeholder" ); |
assert.ok( hash.position && ( "top" in hash.position && "left" in hash.position ), "UI hash includes: position" ); |
assert.ok( hash.offset && ( hash.offset.top && hash.offset.left ), "UI hash includes: offset" ); |
assert.ok( hash.item, "UI hash includes: item" ); |
assert.ok( hash.sender, "UI hash includes: sender" ); |
assert.equal( overCount, 1, "over fires only once" ); |
} ); |
|
// http://bugs.jqueryui.com/ticket/9335 |
// Sortable: over & out events does not consistently fire |
QUnit.test( "over, fires with draggable connected to sortable", function( assert ) { |
assert.expect( 3 ); |
|
var hash, |
overCount = 0, |
item = $( "<div></div>" ).text( "6" ).insertAfter( "#sortable" ); |
|
item.draggable( { |
connectToSortable: "#sortable" |
} ); |
$( ".connectWith" ).sortable( { |
connectWith: ".connectWith", |
over: function( event, ui ) { |
hash = ui; |
overCount++; |
} |
} ); |
|
item.simulate( "drag", { |
dy: -20 |
} ); |
|
assert.ok( hash, "over event triggered" ); |
assert.ok( !hash.sender, "UI should not include: sender" ); |
assert.equal( overCount, 1, "over fires only once" ); |
} ); |
|
QUnit.test( "over, with connected sortable", function( assert ) { |
assert.expect( 3 ); |
|
var hash, |
overCount = 0; |
|
$( ".connectWith" ).sortable( { |
connectWith: ".connectWith" |
} ); |
$( "#sortable2" ).on( "sortover", function( event, ui ) { |
hash = ui; |
overCount++; |
} ); |
$( "#sortable" ).find( "li:eq(0)" ).simulate( "drag", { |
dy: 102 |
} ); |
|
assert.ok( hash, "over event triggered" ); |
assert.equal( hash.sender[ 0 ], $( " #sortable" )[ 0 ], "UI includes: sender" ); |
assert.equal( overCount, 1, "over fires only once" ); |
} ); |
|
/* |
Test("out", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
*/ |
|
QUnit.test( "out, with connected sortable", function( assert ) { |
assert.expect( 2 ); |
|
var hash, |
outCount = 0; |
|
$( ".connectWith" ).sortable( { |
connectWith: ".connectWith" |
} ); |
$( "#sortable" ).on( "sortout", function( event, ui ) { |
hash = ui; |
outCount++; |
} ); |
$( "#sortable" ).find( "li:last" ).simulate( "drag", { |
dy: 40 |
} ); |
|
assert.ok( hash, "out event triggered" ); |
assert.equal( outCount, 1, "out fires only once" ); |
} ); |
|
QUnit.test( "repeated out & over between connected sortables", function( assert ) { |
assert.expect( 2 ); |
|
var outCount = 0, |
overCount = 0; |
|
$( ".connectWith" ).sortable( { |
connectWith: ".connectWith", |
over: function() { |
overCount++; |
}, |
out: function( event, ui ) { |
|
// Ignore events that trigger when an item has dropped |
// checking for the presence of the helper. |
if ( !ui.helper ) { |
outCount++; |
} |
} |
} ); |
$( "#sortable" ).find( "li:last" ).simulate( "drag", { |
dy: 40 |
} ).simulate( "drag", { |
dy: -40 |
} ); |
|
assert.equal( outCount, 2, "out fires twice" ); |
assert.equal( overCount, 4, "over fires four times" ); |
} ); |
|
/* |
Test("activate", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("deactivate", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
*/ |
|
} ); |
/instantMessage/node_modules/jquery-ui/tests/unit/sortable/methods.js |
@@ -0,0 +1,130 @@ |
define( [ |
"qunit", |
"jquery", |
"./helper", |
"ui/widgets/sortable" |
], function( QUnit, $, testHelper ) { |
|
QUnit.module( "sortable: methods" ); |
|
QUnit.test( "init", function( assert ) { |
assert.expect( 5 ); |
|
$( "<div></div>" ).appendTo( "body" ).sortable().remove(); |
assert.ok( true, ".sortable() called on element" ); |
|
$( [] ).sortable(); |
assert.ok( true, ".sortable() called on empty collection" ); |
|
$( "<div></div>" ).sortable(); |
assert.ok( true, ".sortable() called on disconnected DOMElement" ); |
|
$( "<div></div>" ).sortable().sortable( "option", "foo" ); |
assert.ok( true, "arbitrary option getter after init" ); |
|
$( "<div></div>" ).sortable().sortable( "option", "foo", "bar" ); |
assert.ok( true, "arbitrary option setter after init" ); |
} ); |
|
QUnit.test( "destroy", function( assert ) { |
assert.expect( 4 ); |
$( "<div></div>" ).appendTo( "body" ).sortable().sortable( "destroy" ).remove(); |
assert.ok( true, ".sortable('destroy') called on element" ); |
|
$( [] ).sortable().sortable( "destroy" ); |
assert.ok( true, ".sortable('destroy') called on empty collection" ); |
|
$( "<div></div>" ).sortable().sortable( "destroy" ); |
assert.ok( true, ".sortable('destroy') called on disconnected DOMElement" ); |
|
var expected = $( "<div></div>" ).sortable(), |
actual = expected.sortable( "destroy" ); |
assert.equal( actual, expected, "destroy is chainable" ); |
} ); |
|
QUnit.test( "enable", function( assert ) { |
assert.expect( 5 ); |
|
var el, actual, expected; |
|
el = $( "#sortable" ).sortable( { disabled: true } ); |
|
testHelper.sort( assert, $( "li", el )[ 0 ], 0, 44, 0, ".sortable({ disabled: true })" ); |
|
el.sortable( "enable" ); |
assert.equal( el.sortable( "option", "disabled" ), false, "disabled option getter" ); |
|
el.sortable( "destroy" ); |
el.sortable( { disabled: true } ); |
el.sortable( "option", "disabled", false ); |
assert.equal( el.sortable( "option", "disabled" ), false, "disabled option setter" ); |
|
testHelper.sort( assert, $( "li", el )[ 0 ], 0, 44, 2, ".sortable('option', 'disabled', false)" ); |
|
expected = $( "<div></div>" ).sortable(), |
actual = expected.sortable( "enable" ); |
assert.equal( actual, expected, "enable is chainable" ); |
} ); |
|
QUnit.test( "disable", function( assert ) { |
assert.expect( 9 ); |
|
var chainable, |
element = $( "#sortable" ).sortable( { disabled: false } ); |
|
testHelper.sort( assert, $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" ); |
|
chainable = element.sortable( "disable" ); |
testHelper.sort( assert, $( "li", element )[ 0 ], 0, 44, 0, "disabled.sortable getter" ); |
|
element.sortable( "destroy" ); |
|
element.sortable( { disabled: false } ); |
testHelper.sort( assert, $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" ); |
element.sortable( "option", "disabled", true ); |
assert.equal( element.sortable( "option", "disabled" ), true, "disabled option setter" ); |
|
assert.lacksClasses( element.sortable( "widget" ), "ui-state-disabled" ); |
assert.ok( !element.sortable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" ); |
assert.hasClasses( element.sortable( "widget" ), "ui-sortable-disabled" ); |
|
testHelper.sort( assert, $( "li", element )[ 0 ], 0, 44, 0, ".sortable('option', 'disabled', true)" ); |
assert.equal( chainable, element, "disable is chainable" ); |
} ); |
|
QUnit.test( "refresh() should update the positions of initially empty lists (see #7498)", function( assert ) { |
assert.expect( 1 ); |
|
var changeCount = 0, |
element = $( "#qunit-fixture" ).html( "<ul></ul>" ).find( "ul" ); |
|
element |
.css( { |
"float": "left", |
width: "100px" |
} ) |
.sortable( { |
change: function() { |
changeCount++; |
} |
} ) |
.append( "<li>a</li><li>a</li>" ) |
.find( "li" ) |
.css( { |
"float": "left", |
width: "50px", |
height: "50px" |
} ); |
|
element.sortable( "refresh" ); |
|
// Switch the order of the two li elements |
element.find( "li" ).eq( 0 ).simulate( "drag", { |
dx: 55, |
moves: 15 |
} ); |
|
assert.equal( changeCount, 1 ); |
} ); |
|
} ); |
/instantMessage/node_modules/jquery-ui/tests/unit/sortable/options.js |
@@ -0,0 +1,498 @@ |
define( [ |
"qunit", |
"jquery", |
"ui/widgets/sortable" |
], function( QUnit, $ ) { |
|
QUnit.module( "sortable: options" ); |
|
/* |
Test("{ appendTo: 'parent' }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ appendTo: Selector }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
*/ |
|
QUnit.test( "{ axis: false }, default", function( assert ) { |
assert.expect( 2 ); |
|
var offsetAfter, |
element = $( "#sortable" ).sortable( { |
axis: false, |
change: function() { |
offsetAfter = item.offset(); |
assert.notEqual( offsetAfter.left, offsetBefore.left, "x axis not constrained when axis: false" ); |
assert.notEqual( offsetAfter.top, offsetBefore.top, "y axis not constrained when axis: false" ); |
} |
} ), |
item = element.find( "li" ).eq( 0 ), |
offsetBefore = item.offset(); |
|
item.simulate( "drag", { |
dx: 50, |
dy: 25, |
moves: 1 |
} ); |
} ); |
|
QUnit.test( "{ axis: 'x' }", function( assert ) { |
assert.expect( 2 ); |
|
var offsetAfter, |
element = $( "#sortable" ).sortable( { |
axis: "x", |
change: function() { |
offsetAfter = item.offset(); |
assert.notEqual( offsetAfter.left, offsetBefore.left, "x axis not constrained when axis: x" ); |
assert.equal( offsetAfter.top, offsetBefore.top, "y axis constrained when axis: x" ); |
} |
} ), |
item = element.find( "li" ).eq( 0 ), |
offsetBefore = item.offset(); |
|
item.simulate( "drag", { |
dx: 50, |
dy: 25, |
moves: 1 |
} ); |
} ); |
|
QUnit.test( "{ axis: 'y' }", function( assert ) { |
assert.expect( 2 ); |
|
var offsetAfter, |
element = $( "#sortable" ).sortable( { |
axis: "y", |
change: function() { |
offsetAfter = item.offset(); |
assert.equal( offsetAfter.left, offsetBefore.left, "x axis constrained when axis: y" ); |
assert.notEqual( offsetAfter.top, offsetBefore.top, "y axis not constrained when axis: y" ); |
} |
} ), |
item = element.find( "li" ).eq( 0 ), |
offsetBefore = item.offset(); |
|
item.simulate( "drag", { |
dx: 50, |
dy: 25, |
moves: 1 |
} ); |
} ); |
|
QUnit.test( "#7415: Incorrect revert animation with axis: 'y'", function( assert ) { |
var ready = assert.async(); |
assert.expect( 2 ); |
var expectedLeft, |
element = $( "#sortable" ).sortable( { |
axis: "y", |
revert: true, |
sort: function() { |
expectedLeft = item.css( "left" ); |
} |
} ), |
item = element.find( "li" ).eq( 0 ); |
|
item.simulate( "drag", { |
dy: 300, |
dx: 50 |
} ); |
|
setTimeout( function() { |
var top = parseFloat( item.css( "top" ) ); |
assert.equal( item.css( "left" ), expectedLeft, "left not animated" ); |
assert.ok( top > 0 && top < 300, "top is animated" ); |
ready(); |
}, 100 ); |
} ); |
|
/* |
Test("{ cancel: 'input,textarea,button,select,option' }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ cancel: Selector }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
*/ |
|
QUnit.test( "#8792: issues with floated items in connected lists", function( assert ) { |
assert.expect( 2 ); |
|
var element, |
changeCount = 0; |
|
$( "#qunit-fixture" ) |
.html( "<ul class='c'><li>a</li><li>a</li></ul><ul class='c'><li>a</li><li>a</li></ul>" ) |
.find( "ul" ).css( { "float": "left", width: "100px" } ).end() |
.find( "li" ).css( { "float": "left", width: "50px", height: "50px" } ); |
|
$( "#qunit-fixture .c" ).sortable( { |
connectWith: "#qunit-fixture .c", |
change: function() { |
changeCount++; |
} |
} ); |
|
element = $( "#qunit-fixture li:eq(0)" ); |
|
// Move the first li to the right of the second li in the first ul |
element.simulate( "drag", { |
dx: 55, |
moves: 15 |
} ); |
|
assert.equal( changeCount, 1, "change fired only once (no jitters) when dragging a floated sortable in it's own container" ); |
|
// Move the first li ( which is now in the second spot ) |
// through the first spot in the second ul to the second spot in the second ul |
element.simulate( "drag", { |
dx: 100, |
moves: 15 |
} ); |
|
assert.equal( changeCount, 3, "change fired once for each expected change when dragging a floated sortable to a connected container" ); |
} ); |
|
QUnit.test( "#8301: single axis with connected list", function( assert ) { |
assert.expect( 1 ); |
|
var element = $( "#sortable" ).sortable( { |
axis: "y", |
tolerance: "pointer", |
connectWith: ".connected" |
} ); |
|
$( "<ul class='connected'><li>Item 7</li><li>Item 8</li></ul>" ) |
.sortable( { |
axis: "y", |
tolerance: "pointer", |
connectWith: "#sortable", |
receive: function() { |
assert.ok( true, "connected list received item" ); |
} |
} ) |
.insertAfter( element ); |
|
element.find( "li" ).eq( 0 ).simulate( "drag", { |
handle: "corner", |
dy: 120, |
moves: 1 |
} ); |
} ); |
|
/* |
Test("{ connectWith: false }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ connectWith: Selector }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ containment: false }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ containment: Element }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ containment: 'document' }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ containment: 'parent' }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ containment: 'window' }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ containment: Selector }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ cursor: 'auto' }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ cursor: 'move' }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ cursorAt: false }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ cursorAt: true }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ delay: 0 }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ delay: 100 }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ distance: 1 }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ distance: 10 }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ dropOnEmpty: true }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ dropOnEmpty: false }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ forcePlaceholderSize: false }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ forcePlaceholderSize: true }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ forceHelperSize: false }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ forceHelperSize: true }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ grid: false }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ grid: [17, 3] }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ grid: [3, 7] }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ handle: false }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ handle: Element }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ handle: Selector }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ helper: 'original' }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ helper: Function }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ items: '> *' }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ items: Selector }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ opacity: false }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ opacity: .37 }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ opacity: 1 }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ placeholder: false }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
*/ |
|
QUnit.test( "{ placeholder: false } img", function( assert ) { |
assert.expect( 3 ); |
|
var element = $( "#sortable-images" ).sortable( { |
start: function( event, ui ) { |
assert.ok( ui.placeholder.attr( "src" ).indexOf( "images/jqueryui_32x32.png" ) > 0, "placeholder img has correct src" ); |
assert.equal( ui.placeholder.height(), 32, "placeholder has correct height" ); |
assert.equal( ui.placeholder.width(), 32, "placeholder has correct width" ); |
} |
} ); |
|
element.find( "img" ).eq( 0 ).simulate( "drag", { |
dy: 1 |
} ); |
} ); |
|
QUnit.test( "{ placeholder: String }", function( assert ) { |
assert.expect( 1 ); |
|
var element = $( "#sortable" ).sortable( { |
placeholder: "test", |
start: function( event, ui ) { |
assert.hasClasses( ui.placeholder, "test" ); |
} |
} ); |
|
element.find( "li" ).eq( 0 ).simulate( "drag", { |
dy: 1 |
} ); |
} ); |
|
QUnit.test( "{ placholder: String } tr", function( assert ) { |
assert.expect( 4 ); |
|
var originalWidths, |
element = $( "#sortable-table tbody" ).sortable( { |
placeholder: "test", |
start: function( event, ui ) { |
var currentWidths = otherRow.children().map( function() { |
return $( this ).width(); |
} ).get(); |
assert.hasClasses( ui.placeholder, "test" ); |
assert.deepEqual( currentWidths, originalWidths, "table cells maintian size" ); |
assert.equal( ui.placeholder.children().length, dragRow.children().length, |
"placeholder has correct number of cells" ); |
assert.equal( ui.placeholder.children().html(), $( "<span> </span>" ).html(), |
"placeholder td has content for forced dimensions" ); |
} |
} ), |
rows = element.children( "tr" ), |
dragRow = rows.eq( 0 ), |
otherRow = rows.eq( 1 ); |
|
originalWidths = otherRow.children().map( function() { |
return $( this ).width(); |
} ).get(); |
dragRow.simulate( "drag", { |
dy: 1 |
} ); |
} ); |
|
QUnit.test( "{ placholder: String } tbody", function( assert ) { |
assert.expect( 6 ); |
|
var originalWidths, |
element = $( "#sortable-table" ).sortable( { |
placeholder: "test", |
start: function( event, ui ) { |
var currentWidths = otherBody.children().map( function() { |
return $( this ).width(); |
} ).get(); |
assert.ok( ui.placeholder.hasClass( "test" ), "placeholder has class" ); |
assert.deepEqual( currentWidths, originalWidths, "table cells maintain size" ); |
assert.equal( ui.placeholder.children().length, 1, |
"placeholder has one child" ); |
assert.equal( ui.placeholder.children( "tr" ).length, 1, |
"placeholder's child is tr" ); |
assert.equal( ui.placeholder.find( "> tr" ).children().length, |
dragBody.find( "> tr:first" ).children().length, |
"placeholder's tr has correct number of cells" ); |
assert.equal( ui.placeholder.find( "> tr" ).children().html(), |
$( "<span> </span>" ).html(), |
"placeholder td has content for forced dimensions" ); |
} |
} ), |
bodies = element.children( "tbody" ), |
dragBody = bodies.eq( 0 ), |
otherBody = bodies.eq( 1 ); |
|
originalWidths = otherBody.children().map( function() { |
return $( this ).width(); |
} ).get(); |
dragBody.simulate( "drag", { |
dy: 1 |
} ); |
} ); |
|
/* |
Test("{ revert: false }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ revert: true }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ scroll: true }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ scroll: false }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ scrollSensitivity: 20 }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ scrollSensitivity: 2 }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ scrollSensitivity: 200 }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ scrollSpeed: 20 }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ scrollSpeed: 2 }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ scrollSpeed: 200 }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ scope: 'default' }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ scope: ??? }, unexpected", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ tolerance: 'intersect' }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ tolerance: 'pointer' }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ zIndex: 1000 }, default", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ zIndex: 1 }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
|
test("{ zIndex: false }", function() { |
ok(false, "missing test - untested code is broken code."); |
}); |
*/ |
} ); |