Skip to content

Commit

Permalink
Merge pull request #105 from martinhoefling/browsercrash
Browse files Browse the repository at this point in the history
fix for browser crash when jsonapi not configured, closes #104
  • Loading branch information
Pharb authored Jan 6, 2019
2 parents d9413b1 + 398582e commit f41816e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/unit/popup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,18 @@ describe('popup', () => {

describe('logAndDisplayError', () => {
test('displays message', () => {
popup.logAndDisplayError({ message: 'sample error messsage' });
expect(() => {
popup.logAndDisplayError({ message: 'sample error messsage' });
}).toThrow({ message: 'sample error messsage' });
expect(document.getElementsByClassName('status-text')[0].innerHTML).toBe('sample error messsage');
});

test('switches back to search', () => {
expect.assertions(3);
expect.assertions(4);
return popup.switchToCreateNewDialog().then(() => {
popup.logAndDisplayError({ message: 'sample error messsage' });
expect(() => {
popup.logAndDisplayError({ message: 'sample error messsage' });
}).toThrow({ message: 'sample error messsage' });
expect(document.getElementsByClassName('search')[0].style.display).toBe('block');
expect(document.getElementsByClassName('results')[0].style.display).toBe('block');
expect(document.getElementsByClassName('create')[0].style.display).toBe('none');
Expand Down
1 change: 1 addition & 0 deletions web-extension/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function logAndDisplayError(error) {
console.log(error);
switchToSearch();
setStatusText(error.message);
throw error;
}

function copyToClipboard(text) {
Expand Down

0 comments on commit f41816e

Please sign in to comment.