Skip to content

Commit

Permalink
Add missing colspan for cell with message about empty data
Browse files Browse the repository at this point in the history
  • Loading branch information
kronusme committed Nov 18, 2016
1 parent bd2c4ba commit a538740
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addon/templates/components/models-table.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{{partial rowTemplate}}
{{/each}}
{{else}}
<tr><td>{{{messages.noDataToShow}}}</td></tr>
<tr><td colspan="{{visibleProcessedColumns.length}}">{{{messages.noDataToShow}}}</td></tr>
{{/if}}
{{/if}}
</tbody>
Expand Down
10 changes: 8 additions & 2 deletions tests/integration/components/models-table-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,16 @@ test('global filtering (ignore case OFF)', function(assert) {
_globalFilter('invalid input');

assert.equal(_getEachAsString(selectors.firstColumn), 'No records to show', 'All rows are filtered out and proper message is shown');
assert.equal(_getEachAttrAsString(selectors.firstColumn, 'colspan'), columns.length, 'cell with message has correct colspan');

});

test('global filtering (ignore case ON)', function(assert) {

var columns = generateColumns(['index', 'someWord']);
this.setProperties({
filteringIgnoreCase: true,
columns: generateColumns(['index', 'someWord']),
columns: columns,
data: generateContent(10, 1)
});
this.render(hbs`{{models-table columns=columns data=data filteringIgnoreCase=filteringIgnoreCase}}`);
Expand All @@ -485,6 +487,7 @@ test('global filtering (ignore case ON)', function(assert) {
_globalFilter('invalid input');

assert.equal(_getEachAsString(selectors.firstColumn), 'No records to show', 'All rows are filtered out and proper message is shown');
assert.equal(_getEachAttrAsString(selectors.firstColumn, 'colspan'), columns.length, 'cell with message has correct colspan');

_globalFilter('');
_sortFirstColumn();
Expand Down Expand Up @@ -519,6 +522,7 @@ test('filtering by columns (ignore case OFF)', function (assert) {
_filterFirstColumn('invalid input');

assert.equal(_getEachAsString(selectors.firstColumn), 'No records to show', 'All rows are filtered out and proper message is shown');
assert.equal(_getEachAttrAsString(selectors.firstColumn, 'colspan'), columns.length, 'cell with message has correct colspan');

assert.equal(_getEachAttrAsString(selectors.theadSecondRowFirstColumnFilter, 'placeholder'), 'custom placeholder', 'Placeholder is correct');

Expand All @@ -531,10 +535,11 @@ test('filtering by columns (ignore case OFF)', function (assert) {

test('filtering by columns (ignore case ON)', function (assert) {

var columns = generateColumns(['index', 'someWord']);
this.setProperties({
filteringIgnoreCase: true,
useFilteringByColumns: true,
columns: generateColumns(['index', 'someWord']),
columns: columns,
data: generateContent(10, 1)
});

Expand All @@ -549,6 +554,7 @@ test('filtering by columns (ignore case ON)', function (assert) {
_filterSecondColumn('invalid input');

assert.equal(_getEachAsString(selectors.firstColumn), 'No records to show', 'All rows are filtered out and proper message is shown');
assert.equal(_getEachAttrAsString(selectors.firstColumn, 'colspan'), columns.length, 'cell with message has correct colspan');

_filterSecondColumn('');

Expand Down

0 comments on commit a538740

Please sign in to comment.