Permalink
Browse files

Table: add class ui-state-disabled if initially disabled

  • Loading branch information...
gabrielschulhof authored and arschmitz committed Jun 18, 2014
1 parent f79c2a8 commit 35c2c0a42f58f7373427b21a45a62c6938d151ed
Showing with 37 additions and 2 deletions.
  1. +5 −2 js/widgets/table.js
  2. +27 −0 tests/unit/table/basic-table-tests.html
  3. +5 −0 tests/unit/table/basic_table_core.js
View
@@ -48,8 +48,11 @@ return $.widget( "mobile.table", {
allHeaders: null,
_create: function() {
if ( !this.options.enhanced ) {
this.element.addClass( this.options.classes.table );
var options = this.options;
if ( !options.enhanced ) {
this.element.addClass( options.classes.table +
( options.disabled ? " ui-state-disabled" : "" ) );
}
this.refresh();
@@ -49,6 +49,33 @@
</tr>
</tbody>
</table>
<table id="table-initially-disabled" data-nstest-role="table" class="ui-responsive" data-nstest-disabled="true">
<thead>
<tr>
<th data-nstest-priority="2">Rank</th>
<th>Movie Title</th>
<th data-nstest-priority="3">Year</th>
<th data-nstest-priority="1"><abbr title="Rotten Tomato Rating">Rating</abbr></th>
<th data-nstest-priority="5">Reviews</th>
</tr>
</thead>
<tbody>
<tr>
<th>1</th>
<td><a href="http://en.wikipedia.org/wiki/Citizen_Kane" data-nstest-rel="external">Citizen Kane</a></td>
<td>1941</td>
<td>100%</td>
<td>74</td>
</tr>
<tr>
<th>2</th>
<td><a href="http://en.wikipedia.org/wiki/Casablanca_(film)" data-nstest-rel="external">Casablanca</a></td>
<td>1942</td>
<td>97%</td>
<td>64</td>
</tr>
</tbody>
</table>
<table id="table-disable-test" data-nstest-role="table" data-nstest-mode="reflow" class="ui-responsive">
<thead>
<tr>
@@ -21,3 +21,8 @@ test( "Basic table is disabled/enabled correctly", function() {
deepEqual( table.hasClass( "ui-state-disabled" ), false,
"Table does not have the ui-state-disabled class when enabled" );
});
test( "Basic initially disabled table has ui-state-disabled class", function() {
deepEqual( $( "#table-initially-disabled" ).hasClass( "ui-state-disabled" ), true,
"class 'ui-state-disabled' is present" );
});

0 comments on commit 35c2c0a

Please sign in to comment.