Skip to content

Commit

Permalink
Fix. test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
SanoferSameera committed Nov 30, 2023
1 parent 0c5c249 commit 155a9af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/form-builder/components/FormList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class FormList extends Component {
<td>
<b className="edit-icon">{this._editOrReuseIcon(rowItem)}</b>
<a hidden={!rowItem.published}
onClick={() => this.downloadFile(index)}
onClick={() => this.downloadFile(index)} title="Export Form"
>
<i className="fa fa-download" title="Export Form" />
</a>
Expand Down
11 changes: 6 additions & 5 deletions test/form-builder/components/FormList.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ describe('FormList', () => {
it('should render Export when form published', () => {
wrapper = shallow(<FormList data={data} handleSelectedForm={undefined} />);

expect(getItem(0, 5).find('a').prop('hidden')).to.eql(true);
expect(getItem(1, 5).find('a').prop('hidden')).to.eql(false);
expect(getItem(1, 5).find('a').find('i').prop('className')).to.eql('fa fa-download');
expect(getItem(0, 5).find('a[title="Export Form"]').prop('hidden')).to.eql(true);
expect(getItem(1, 5).find('a[title="Export Form"]').prop('hidden')).to.eql(false);
expect(getItem(1, 5).find('a[title="Export Form"]')
.find('i').prop('className')).to.eql('fa fa-download');
});

it('should call downloadFile when export be clicked', (done) => {
Expand All @@ -113,7 +114,7 @@ describe('FormList', () => {
.onSecondCall(1).returns(Promise.resolve([]));

wrapper = shallow(<FormList data={data} />);
const exportElement = getItem(0, 5).find('a');
const exportElement = getItem(0, 5).find('a[title="Export Form"]');
exportElement.simulate('click');
const params =
'v=custom:(id,uuid,name,version,published,auditInfo,' +
Expand Down Expand Up @@ -142,7 +143,7 @@ describe('FormList', () => {
wrapper = shallow(<FormList data={data} handleSelectedForm={undefined} />);
const spy = sinon.spy(wrapper.instance(), 'setMessage');

const exportElement = getItem(1, 5).find('a');
const exportElement = getItem(1, 5).find('a[title="Export Form"]');
exportElement.simulate('click');

setTimeout(() => {
Expand Down

0 comments on commit 155a9af

Please sign in to comment.