Fixed failure to render gh-members-import-table compontent

refs 4ee30dc5bd

- The tests were failing because there was no protective code to check for empty parameters.
This commit is contained in:
Nazar Gargol 2020-07-08 23:10:48 +12:00
parent 5d261bfde8
commit 2da05338dd
2 changed files with 8 additions and 12 deletions

View File

@ -24,19 +24,11 @@ export default class GhMembersImportTable extends Component {
}
get hasNextRecord() {
const nextValue = this.dataPreviewIndex + 1;
if (this.args.importData[nextValue]) {
return true;
}
return false;
return this.args.importData && !!(this.args.importData[this.dataPreviewIndex + 1]);
}
get hasPrevRecord() {
const nextValue = this.dataPreviewIndex - 1;
if (this.args.importData[nextValue]) {
return true;
}
return false;
return this.args.importData && !!(this.args.importData[this.dataPreviewIndex - 1]);
}
get currentRecord() {
@ -44,7 +36,11 @@ export default class GhMembersImportTable extends Component {
}
get allRecords() {
return this.args.importData.length;
if (this.args.importData) {
return this.args.importData.length;
} else {
return 0;
}
}
@action

View File

@ -21,7 +21,7 @@ describe('Integration: Component: gh-members-import-table', function () {
expect(find('table')).to.exist;
expect(findAll('table thead th').length).to.equal(3);
expect(findAll('table tbody tr').length).to.equal(1);
expect(find('table tbody tr').textContent).to.match(/No data/);
expect(find('table tbody').textContent).to.match(/No data/);
});
it('renders members data with all the properties', async function () {