aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2013-04-02 10:42:21 -0400
committerScott González <scott.gonzalez@gmail.com>2013-04-17 15:09:06 -0400
commit9711c54c6d3d7ecffa9bfccc205522be1f4aa148 (patch)
tree042592feb29b81d71d274c59da2c416f96d15658 /tests
parent83e0b4c6c8447bc4c496596c4d73c0cd36adefc4 (diff)
downloadjquery-ui-9711c54c6d3d7ecffa9bfccc205522be1f4aa148.tar.gz
jquery-ui-9711c54c6d3d7ecffa9bfccc205522be1f4aa148.zip
Sortable: Copy the cell structure when sorting a table row. Fixes #9185 - Sortable: Placeholder breaks table-layout: fixed.
(cherry picked from commit 09b3533910e887377fc87126608db1ded06f38f6)
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/sortable/sortable.html3
-rw-r--r--tests/unit/sortable/sortable_options.js38
2 files changed, 28 insertions, 13 deletions
diff --git a/tests/unit/sortable/sortable.html b/tests/unit/sortable/sortable.html
index 7db14d482..8e0bac501 100644
--- a/tests/unit/sortable/sortable.html
+++ b/tests/unit/sortable/sortable.html
@@ -44,6 +44,9 @@
border-width: 0;
height:19px;
}
+ #sortable-table {
+ width: 100%;
+ }
</style>
</head>
<body>
diff --git a/tests/unit/sortable/sortable_options.js b/tests/unit/sortable/sortable_options.js
index f0185b078..f2beb4dbc 100644
--- a/tests/unit/sortable/sortable_options.js
+++ b/tests/unit/sortable/sortable_options.js
@@ -359,19 +359,31 @@ test( "{ placeholder: String }", function() {
});
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>&#160;</span>" ).html(),
- "placeholder td has content for forced dimensions" );
- }
- });
-
- element.find( "tr" ).eq( 0 ).simulate( "drag", {
+ 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();
+ ok( ui.placeholder.hasClass( "test" ), "placeholder has class" );
+ deepEqual( currentWidths, originalWidths, "table cells maintian size" );
+ equal( ui.placeholder.children().length, dragRow.children().length,
+ "placeholder has correct number of cells" );
+ equal( ui.placeholder.children().html(), $( "<span>&#160;</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
});
});