Permalink
Browse files

Fix #2950. Don't show locale warning on graduated experiments (#3058)

* Fix #2950. Don't show locale warning on graduated experiments

* Fix typo
  • Loading branch information...
kgeorgiou authored and lmorchard committed Nov 13, 2017
1 parent 19d62f8 commit 4429a3300dd2f2e150f8332c540a0b0c3f3d32bc
@@ -42,7 +42,7 @@ export default function DetailsDescription({
<div className="details-description">
{completed && !graduated && <EolBlock {...{ experiment, l10nId }} />}
<IncompatibleAddons {...{ experiment, installedAddons }} />
<LocaleWarning {...{ experiment, locale, hasAddon }} />
{!graduated && <LocaleWarning {...{ experiment, locale, hasAddon }} />}
{graduated && <GraduatedNotice {...{ graduated, graduation_url }} />}
{video_url &&
@@ -18,6 +18,7 @@ import ExperimentEolDialog from './ExperimentEolDialog';
import ExperimentTourDialog from './ExperimentTourDialog';
import { PRIVACY_SCROLL_OFFSET } from './DetailsHeader';
import DetailsDescription, { LocaleWarning } from './DetailsDescription';
describe('app/containers/ExperimentPage', () => {
const mockExperiment = {
@@ -171,6 +172,32 @@ describe('app/containers/ExperimentPage:ExperimentDetail', () => {
.to.have.property('length', 1);
});
it('should not render a locale warning for unsupported locales, on graduated experiments', () => {
const unsupportedLocale = 'de';
subject.setProps({
isAfterCompletedDate: sinon.stub().returns(true),
locale: unsupportedLocale
});
setExperiment({
...mockExperiment,
locale_blocklist: unsupportedLocale
});
expect(subject.find(DetailsDescription).find(LocaleWarning)).to.have.length(0);
});
it('should render a locale warning for unsupported locales, on non-graduated experiments', () => {
const unsupportedLocale = 'de';
subject.setProps({
isAfterCompletedDate: sinon.stub().returns(false),
locale: unsupportedLocale
});
setExperiment({
...mockExperiment,
locale_blocklist: unsupportedLocale
});
expect(subject.find(DetailsDescription).find(LocaleWarning)).to.have.length(1);
});
describe('with a valid experiment slug', () => {
beforeEach(() => {
setExperiment(mockExperiment);

0 comments on commit 4429a33

Please sign in to comment.