1
0
Fork 0

Test covering file-table loop for file-table-item's

This commit is contained in:
Joe Wroten 2018-12-16 13:33:21 -06:00
parent a654423557
commit 7229af4fdb
2 changed files with 21 additions and 2 deletions

View file

@ -15,7 +15,10 @@
</thead>
<tbody>
{{#each files as | file |}}
{{file-table-item file=file selectedFilePaths=selectedFilePaths}}
{{file-table-item
file=file
selectedFilePaths=selectedFilePaths
}}
{{/each}}
</tbody>
</table>

View file

@ -1,8 +1,17 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { render, find, findAll } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
const genericFile = () => {
return {
name: 'foo.bar',
device: 'Baz',
path: '~/foo.bar',
status: 'available',
};
};
module('Integration | Component | file-table', function(hooks) {
setupRenderingTest(hooks);
@ -16,4 +25,11 @@ module('Integration | Component | file-table', function(hooks) {
assert.ok(find('[data-test-id=file-table-header]'), 'Table header');
assert.notOk(find('[data-test-id=file-table-item]'), 'Should have no table rows without data');
});
test('it renders rows of files', async function(assert) {
this.set('files', [genericFile(), genericFile()]);
await render(hbs`{{file-table files=files}}`);
assert.equal(findAll('[data-test-id=file-table-item]').length, 2, 'Found expected two rows');
});
});