diff options
| author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-15 15:09:29 +0000 |
|---|---|---|
| committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-15 15:09:29 +0000 |
| commit | 16cdacff02fbf0069182e090df2eeaa754007957 (patch) | |
| tree | 5d19a3022bb7266834dad55a757f53bd48dc44e5 /spec/frontend/lib/utils/common_utils_spec.js | |
| parent | 37439afe69efe58e2351d899d231670d945be5e2 (diff) | |
| download | gitlab-ce-16cdacff02fbf0069182e090df2eeaa754007957.tar.gz | |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/lib/utils/common_utils_spec.js')
| -rw-r--r-- | spec/frontend/lib/utils/common_utils_spec.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/frontend/lib/utils/common_utils_spec.js b/spec/frontend/lib/utils/common_utils_spec.js index 947c38c8ae8..08ba78cddff 100644 --- a/spec/frontend/lib/utils/common_utils_spec.js +++ b/spec/frontend/lib/utils/common_utils_spec.js @@ -1,4 +1,5 @@ import * as commonUtils from '~/lib/utils/common_utils'; +import setWindowLocation from 'helpers/set_window_location_helper'; describe('common_utils', () => { describe('getPagePath', () => { @@ -1069,4 +1070,35 @@ describe('common_utils', () => { expect(result).toEqual([{ hello: '' }, { helloWorld: '' }]); }); }); + + describe('useNewFonts', () => { + let beforeGon; + const beforeLocation = window.location.href; + + beforeEach(() => { + window.gon = window.gon || {}; + beforeGon = { ...window.gon }; + }); + + describe.each` + featureFlag | queryParameter | fontEnabled + ${false} | ${false} | ${false} + ${true} | ${false} | ${true} + ${false} | ${true} | ${true} + `('new font', ({ featureFlag, queryParameter, fontEnabled }) => { + it(`will ${fontEnabled ? '' : 'NOT '}be applied when feature flag is ${ + featureFlag ? '' : 'NOT ' + }set and query parameter is ${queryParameter ? '' : 'NOT '}present`, () => { + const search = queryParameter ? `?new_fonts` : ''; + setWindowLocation(search); + window.gon = { features: { newFonts: featureFlag } }; + expect(commonUtils.useNewFonts()).toBe(fontEnabled); + }); + }); + + afterEach(() => { + window.gon = beforeGon; + setWindowLocation(beforeLocation); + }); + }); }); |
