Test covering file-table loop for file-table-item's
This commit is contained in:
parent
a654423557
commit
7229af4fdb
2 changed files with 21 additions and 2 deletions
|
@ -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>
|
|
@ -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');
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue