Download alert has expected content
This commit is contained in:
parent
60445ef22c
commit
8e7d12e3cb
3 changed files with 15 additions and 1 deletions
|
@ -15,6 +15,12 @@ export default Component.extend({
|
|||
} else return this.selectedFilePaths.length === 0 ? 'none' : 'some';
|
||||
}),
|
||||
|
||||
selectedFileDownloads: computed('selectedFilePaths.[]', 'files.@each.{status,path}', function() {
|
||||
return this.selectedFilePaths.map(path => {
|
||||
return this.files.find(file => file.status === 'available' && file.path === path);
|
||||
})
|
||||
}),
|
||||
|
||||
actions: {
|
||||
downloadSelected() {
|
||||
set(this, 'showDownloadAlert', true);
|
||||
|
|
|
@ -9,7 +9,11 @@
|
|||
>
|
||||
Close
|
||||
</button>
|
||||
Foo
|
||||
<ol>
|
||||
{{#each selectedFileDownloads as | file |}}
|
||||
<li><strong>{{file.device}}</strong>: <code>{{file.path}}</code></li>
|
||||
{{/each}}
|
||||
</ol>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
|
|
|
@ -90,11 +90,15 @@ module('Integration | Component | file-table', function(hooks) {
|
|||
|
||||
test('it handles showing download device/path for selected available files', async function(assert) {
|
||||
this.set('files', [genericFile(), genericFile()]);
|
||||
this.set('files.1.status', 'scheduled');
|
||||
await render(hbs`{{file-table files=files}}`);
|
||||
await click('[data-test-action=file-table-select-all]');
|
||||
await click('[data-test-action=file-table-download-selected]');
|
||||
|
||||
assert.ok(find('[data-test-id=file-table-download-alert]'), 'Renders download alert wrapper');
|
||||
assert.equal(find('[data-test-id=file-table-download-alert]').innerText.includes(this.files[0].device), true, 'Renders first file device');
|
||||
assert.equal(find('[data-test-id=file-table-download-alert]').innerText.includes(this.files[0].path), true, 'Renders first file path');
|
||||
assert.equal(find('[data-test-id=file-table-download-alert]').innerText.includes(this.files[1].path), false, 'Does NOT render second file path');
|
||||
|
||||
await click('[data-test-action=file-table-download-close]');
|
||||
assert.notOk(find('[data-test-id=file-table-download-alert]'), 'Closes download alert wrapper');
|
||||
|
|
Loading…
Add table
Reference in a new issue