diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/sortable/sortable.html | 21 | ||||
-rw-r--r-- | tests/unit/sortable/sortable_options.js | 34 |
2 files changed, 53 insertions, 2 deletions
diff --git a/tests/unit/sortable/sortable.html b/tests/unit/sortable/sortable.html index c23a15854..6e326a865 100644 --- a/tests/unit/sortable/sortable.html +++ b/tests/unit/sortable/sortable.html @@ -63,6 +63,27 @@ <li>Item 5</li> </ul> +<table id="sortable-table"> + <tbody> + <tr> + <td>1</td> + <td>2</td> + </tr> + <tr> + <td>3</td> + <td>4</td> + </tr> + <tr> + <td>5</td> + <td>6</td> + </tr> + <tr> + <td>7</td> + <td>8</td> + </tr> + </tbody> +</table> + </div> </body> </html> diff --git a/tests/unit/sortable/sortable_options.js b/tests/unit/sortable/sortable_options.js index cf35aedb1..fe50be002 100644 --- a/tests/unit/sortable/sortable_options.js +++ b/tests/unit/sortable/sortable_options.js @@ -185,11 +185,41 @@ test("{ opacity: 1 }", function() { test("{ placeholder: false }, default", function() { ok(false, "missing test - untested code is broken code."); }); +*/ +test( "{ placeholder: String }", function() { + expect( 1 ); -test("{ placeholder: String }", function() { - ok(false, "missing test - untested code is broken code."); + var element = $( "#sortable" ).sortable({ + placeholder: "test", + start: function( event, ui ) { + ok( ui.placeholder.hasClass( "test" ), "placeholder has class" ); + } + }); + + element.find( "li" ).eq( 0 ).simulate( "drag", { + dy: 1 + }); +}); + +test( "{ placholder: String } tr", function() { + expect( 3 ); + + var element = $( "#sortable-table tbody" ).sortable({ + placeholder: "test", + start: function( event, ui ) { + ok( ui.placeholder.hasClass( "test" ), "placeholder has class" ); + equal( ui.placeholder.children().length, 1, "placeholder tr contains a td" ); + equal( ui.placeholder.children().html(), $( "<span> </span>" ).html(), + "placeholder td has content for forced dimensions" ); + } + }); + + element.find( "tr" ).eq( 0 ).simulate( "drag", { + dy: 1 + }); }); +/* test("{ revert: false }, default", function() { ok(false, "missing test - untested code is broken code."); }); |