Skip to content

Commit

Permalink
Merge pull request #246 from opendatakit/submission-table-bug
Browse files Browse the repository at this point in the history
Do not show encryption message if fieldColumns is empty
  • Loading branch information
matthew-white authored Aug 14, 2019
2 parents 978becb + d792c70 commit c7908f1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/components/submission/row.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ except according to the terms contained in the LICENSE file.
</template>
</td>
</template>
<template v-else>
<td :colspan="fieldColumns.length">
<template v-else-if="fieldColumns.length !== 0">
<td class="encrypted-data" :colspan="fieldColumns.length">
<span class="icon-lock"></span>
<span class="encryption-message">Data preview is not available due to
encryption.</span>
Expand Down Expand Up @@ -210,7 +210,7 @@ $icon-lock-margin-right: 12px;
}

~ .encrypted-submission {
td:first-child {
.encrypted-data {
position: relative;
}

Expand Down
45 changes: 30 additions & 15 deletions test/components/submission/list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,23 +470,38 @@ describe('SubmissionList', () => {
});
});

it('indicates whether a submission is encrypted', () => {
const key = testData.standardKeys.createPast(1).last();
testData.extendedProjects.createPast(1, { key });
testData.extendedForms.createPast(1, { submissions: 2 });
testData.extendedSubmissions
.createPast(1, { status: null })
.createPast(1, { status: 'NotDecrypted' });
return loadSubmissionList().afterResponses(component => {
const tr = component.find('#submission-table2 tbody tr');
tr.length.should.equal(2);
describe('encrypted submissions', () => {
it('indicates whether a submission is encrypted', () => {
const key = testData.standardKeys.createPast(1).last();
testData.extendedProjects.createPast(1, { key });
testData.extendedForms.createPast(1, { submissions: 2 });
testData.extendedSubmissions
.createPast(1, { status: null })
.createPast(1, { status: 'NotDecrypted' });
return loadSubmissionList().afterResponses(component => {
const tr = component.find('#submission-table2 tbody tr');
tr.length.should.equal(2);

tr[1].hasClass('encrypted-submission').should.be.false();
tr[1].find('td').length.should.equal(11);
tr[1].hasClass('encrypted-submission').should.be.false();
tr[1].find('td').length.should.equal(11);

tr[0].hasClass('encrypted-submission').should.be.true();
tr[0].find('td').length.should.equal(2);
tr[0].first('td').getAttribute('colspan').should.equal('10');
tr[0].hasClass('encrypted-submission').should.be.true();
tr[0].find('td').length.should.equal(2);
tr[0].first('td').getAttribute('colspan').should.equal('10');
});
});

it('does not show encryption message if form only has instanceID field', () => {
const key = testData.standardKeys.createPast(1).last();
testData.extendedProjects.createPast(1, { key });
const schema = [{ path: ['meta', 'instanceID'], type: 'string' }];
testData.extendedForms.createPast(1, { schema, submissions: 1 });
testData.extendedSubmissions.createPast(1, { status: 'NotDecrypted' });
return loadSubmissionList().afterResponses(component => {
const td = component.find('#submission-table2 tbody td');
td.length.should.equal(1);
should.not.exist(td[0].element.getAttribute('colspan'));
});
});
});

Expand Down

0 comments on commit c7908f1

Please sign in to comment.