Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
feat(connect-device): allow showSuccessMessage search param
Browse files Browse the repository at this point in the history
  • Loading branch information
eoger committed Oct 17, 2018
1 parent 7ae20e2 commit 30406e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/scripts/views/connect_another_device.js
Expand Up @@ -223,7 +223,8 @@ define(function (require, exports, module) {
* @private
*/
_showSuccessMessage () {
return !! this.model.get('showSuccessMessage');
return !! this.model.get('showSuccessMessage') ||
!! this.getSearchParam('showSuccessMessage');
}

/**
Expand Down
18 changes: 18 additions & 0 deletions app/tests/spec/views/connect_another_device.js
Expand Up @@ -360,6 +360,24 @@ define(function (require, exports, module) {
});
});

describe('with showSuccessMessage in the search params', () => {
beforeEach(() => {
sinon.stub(view, '_isSignedIn').callsFake(() => true);

windowMock.navigator.userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:55.0) Gecko/20100101 Firefox/55.0';
windowMock.location.search = 'showSuccessMessage=true';

return view.render()
.then(() => {
view.afterVisible();
});
});

it('shows the success message', () => {
assert.lengthOf(view.$('.success'), 1);
});
});

describe('with showSuccessMessage set to false for a user that can send an SMS', () => {
beforeEach(() => {
model.set('showSuccessMessage', false);
Expand Down

0 comments on commit 30406e9

Please sign in to comment.