diff --git a/ghost/admin/app/components/gh-members-import-table.js b/ghost/admin/app/components/gh-members-import-table.js index b0ab64d919..b658948239 100644 --- a/ghost/admin/app/components/gh-members-import-table.js +++ b/ghost/admin/app/components/gh-members-import-table.js @@ -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 diff --git a/ghost/admin/tests/integration/components/gh-members-import-table-test.js b/ghost/admin/tests/integration/components/gh-members-import-table-test.js index 9785722623..7b96dd8187 100644 --- a/ghost/admin/tests/integration/components/gh-members-import-table-test.js +++ b/ghost/admin/tests/integration/components/gh-members-import-table-test.js @@ -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 () {