Skip to content

Commit

Permalink
Fix View Transaction Dialog (hyperledger-archives#2113)
Browse files Browse the repository at this point in the history
Updated to stop showing error if escape is pressed

contributes to hyperledger/composer#1896
  • Loading branch information
cazfletch authored and nklincoln committed Sep 13, 2017
1 parent d8ec417 commit 590ea77
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,31 @@ describe(`RegistryComponent`, () => {

mockAlertService.errorStatus$.next.should.have.been.calledWith('some error');
}));

it('should handle escape', fakeAsync(() => {
mockClientService.resolveTransactionRelationship.returns(Promise.resolve({$class: 'myTransaction'}));

let componentInstance = {
transaction: {},
events: []
};

mockNgbModal.open = sinon.stub().returns({
componentInstance: componentInstance,
result: Promise.reject(1)
});

let mockTransaction = {mock: 'transaction', eventsEmitted: ['event 1']};
component.viewTransactionData(mockTransaction);

tick();

mockNgbModal.open.should.have.been.called;
componentInstance.transaction.should.deep.equal({$class: 'myTransaction'});
componentInstance.events.should.deep.equal(['event 1']);

mockAlertService.errorStatus$.next.should.not.have.been.called;
}));
});

describe('updateTableScroll', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ export class RegistryComponent {
transactionModalRef.componentInstance.events = transaction.eventsEmitted;

transactionModalRef.result.catch((error) => {
this.alertService.errorStatus$.next(error);
if (error && error !== 1) {
this.alertService.errorStatus$.next(error);
}
});
});
}
Expand Down

0 comments on commit 590ea77

Please sign in to comment.