-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
fix(third-party-auth): Don't show Google/Apple login buttons in the Sync flow
- Loading branch information
Showing
3 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,10 @@ import $ from 'jquery'; | |
import { assert } from 'chai'; | ||
import AuthBroker from 'models/auth_brokers/base'; | ||
import AuthErrors from 'lib/auth-errors'; | ||
import { ENTER_EMAIL } from '../../../../tests/functional/lib/selectors'; | ||
import { | ||
ENTER_EMAIL, | ||
THIRD_PARTY_AUTH, | ||
} from '../../../../tests/functional/lib/selectors'; | ||
import FormPrefill from 'models/form-prefill'; | ||
import IndexView from 'views/index'; | ||
import { Model } from 'backbone'; | ||
|
@@ -16,7 +19,10 @@ import sinon from 'sinon'; | |
import User from 'models/user'; | ||
import WindowMock from '../../mocks/window'; | ||
|
||
const Selectors = ENTER_EMAIL; | ||
const Selectors = { | ||
...ENTER_EMAIL, | ||
THIRD_PARTY_AUTH, | ||
}; | ||
|
||
const EMAIL = '[email protected]'; | ||
|
||
|
@@ -216,6 +222,36 @@ describe('views/index', () => { | |
); | ||
}); | ||
}); | ||
|
||
describe('user is in thirdPartyAuth experiment', () => { | ||
beforeEach(() => { | ||
sinon | ||
.stub(view, 'isInThirdPartyAuthExperiment') | ||
.callsFake(() => true); | ||
}); | ||
|
||
it('renders as expected when not sync', () => { | ||
return view.render().then(() => { | ||
assert.lengthOf(view.$(Selectors.FIREFOX_FAMILY_SERVICES), 0); | ||
assert.lengthOf(view.$(Selectors.THIRD_PARTY_AUTH.GOOGLE), 1); | ||
assert.lengthOf(view.$(Selectors.THIRD_PARTY_AUTH.APPLE), 1); | ||
}); | ||
}); | ||
it('renders as expected when sync', () => { | ||
relier.set({ | ||
action: 'email', | ||
service: 'sync', | ||
serviceName: 'Firefox Sync', | ||
}); | ||
sinon.stub(relier, 'isSync').callsFake(() => true); | ||
|
||
return view.render().then(() => { | ||
assert.lengthOf(view.$(Selectors.FIREFOX_FAMILY_SERVICES), 1); | ||
assert.lengthOf(view.$(Selectors.THIRD_PARTY_AUTH.GOOGLE), 0); | ||
assert.lengthOf(view.$(Selectors.THIRD_PARTY_AUTH.APPLE), 0); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('fallback behavior', () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters