This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Table: Remember hidden columns post-refresh
- Loading branch information
Gabriel Schulhof
committed
Apr 24, 2014
1 parent
b8431e1
commit 5048010
Showing
3 changed files
with
107 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,48 @@ | ||
module( "Table integration tests" ); | ||
|
||
test( "Table refresh does not drop columns", function() { | ||
var eventNs = ".tableRefreshDoesNotDropColumns", | ||
table = $( "#refresh-column-count-test" ), | ||
var table = $( "#refresh-column-count-test" ), | ||
checkbox = $( "#refresh-column-count-test-popup" ) | ||
.find( "input" ).eq( 2 ); | ||
|
||
expect( 1 ); | ||
|
||
checkbox.prop( "checked", false ).trigger( "change" ); | ||
table.table( "refresh" ); | ||
deepEqual( $( "thead tr > *:visible", table[ 0 ] ).length, | ||
$( "tbody tr:first > *:visible", table[ 0 ] ).length, | ||
"Number of visible headers columns equals number of visible " + | ||
"data columns" ); | ||
}); | ||
|
||
test( "Hidden columns stay hidden after row/column addition", function() { | ||
var table = $( "#refresh-hidden-column-test" ); | ||
|
||
// Hide a column | ||
$( "#refresh-hidden-column-test-popup" ).find( "input" ).eq( 2 ) | ||
.prop( "checked", false ) | ||
.checkboxradio( "refresh" ) | ||
.trigger( "change" ); | ||
|
||
// Add a row | ||
table.children( "tbody" ).append( "<tr>" + | ||
"<th>11</th>" + | ||
"<td class='title'><a href='http://en.wikipedia.org/wiki/Day_of_the_triffids' " + | ||
"data-rel='external'>Day of the triffids</a></td>" + | ||
"<td>1963</td>" + | ||
"<td>78%</td>" + | ||
"<td>18</td>" + | ||
"</tr>" ); | ||
table.table( "refresh" ); | ||
|
||
deepEqual( $( "#refresh-hidden-column-test-popup" ).find( "input" ).eq( 2 ).prop( "checked" ), | ||
false, "Checkbox remains unchecked after row addition and table refresh" ); | ||
|
||
// Add a column | ||
table.find( "thead tr th:nth(2)" ).before( "<th data-nstest-priority='4'>Test</th>" ); | ||
table.find( "tbody tr th:nth(2)" ).each( function() { | ||
$( this ).before( "<td>Test</td>" ); | ||
}); | ||
table.table( "refresh" ); | ||
|
||
deepEqual( $( "#refresh-hidden-column-test-popup" ).find( "input" ).eq( 3 ).prop( "checked" ), | ||
false, "Checkbox remains unchecked after row addition and table refresh" ); | ||
}); |