diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-31 21:09:10 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-31 21:09:10 +0000 |
commit | 71c16c702a2c647d723bf7177837ed13f30ee3a5 (patch) | |
tree | 81f83b819439864c2e277fc8c545ec1bbb17c6fe /spec | |
parent | 23332570c97d2b95adecc170a57ca4756346b46a (diff) | |
download | gitlab-ce-71c16c702a2c647d723bf7177837ed13f30ee3a5.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/frontend/pages/projects/edit/mount_search_settings_spec.js | 25 | ||||
-rw-r--r-- | spec/frontend/search_settings/index_spec.js | 37 | ||||
-rw-r--r-- | spec/frontend/search_settings/mount_spec.js | 36 |
3 files changed, 49 insertions, 49 deletions
diff --git a/spec/frontend/pages/projects/edit/mount_search_settings_spec.js b/spec/frontend/pages/projects/edit/mount_search_settings_spec.js deleted file mode 100644 index b48809b3d00..00000000000 --- a/spec/frontend/pages/projects/edit/mount_search_settings_spec.js +++ /dev/null @@ -1,25 +0,0 @@ -import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; -import initSearch from '~/search_settings'; -import mountSearchSettings from '~/pages/projects/edit/mount_search_settings'; - -jest.mock('~/search_settings'); - -describe('pages/projects/edit/mount_search_settings', () => { - afterEach(() => { - resetHTMLFixture(); - }); - - it('initializes search settings when js-search-settings-app is available', async () => { - setHTMLFixture('<div class="js-search-settings-app"></div>'); - - await mountSearchSettings(); - - expect(initSearch).toHaveBeenCalled(); - }); - - it('does not initialize search settings when js-search-settings-app is unavailable', async () => { - await mountSearchSettings(); - - expect(initSearch).not.toHaveBeenCalled(); - }); -}); diff --git a/spec/frontend/search_settings/index_spec.js b/spec/frontend/search_settings/index_spec.js index 122ee1251bb..1d56d054eea 100644 --- a/spec/frontend/search_settings/index_spec.js +++ b/spec/frontend/search_settings/index_spec.js @@ -1,36 +1,25 @@ -import $ from 'jquery'; -import { setHTMLFixture } from 'helpers/fixtures'; +import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; import initSearch from '~/search_settings'; -import { expandSection, closeSection } from '~/settings_panels'; +import mount from '~/search_settings/mount'; -jest.mock('~/settings_panels'); - -describe('search_settings/index', () => { - let app; - - beforeEach(() => { - const el = document.createElement('div'); - - setHTMLFixture('<div id="content-body"></div>'); - - app = initSearch({ el }); - }); +jest.mock('~/search_settings/mount'); +describe('~/search_settings', () => { afterEach(() => { - app.$destroy(); + resetHTMLFixture(); }); - it('calls settings_panel.onExpand when expand event is emitted', () => { - const section = { name: 'section' }; - app.$refs.searchSettings.$emit('expand', section); + it('initializes search settings when js-search-settings-app is available', async () => { + setHTMLFixture('<div class="js-search-settings-app"></div>'); + + await initSearch(); - expect(expandSection).toHaveBeenCalledWith($(section)); + expect(mount).toHaveBeenCalled(); }); - it('calls settings_panel.closeSection when collapse event is emitted', () => { - const section = { name: 'section' }; - app.$refs.searchSettings.$emit('collapse', section); + it('does not initialize search settings when js-search-settings-app is unavailable', async () => { + await initSearch(); - expect(closeSection).toHaveBeenCalledWith($(section)); + expect(mount).not.toHaveBeenCalled(); }); }); diff --git a/spec/frontend/search_settings/mount_spec.js b/spec/frontend/search_settings/mount_spec.js new file mode 100644 index 00000000000..b35266e56ae --- /dev/null +++ b/spec/frontend/search_settings/mount_spec.js @@ -0,0 +1,36 @@ +import $ from 'jquery'; +import { setHTMLFixture } from 'helpers/fixtures'; +import mount from '~/search_settings/mount'; +import { expandSection, closeSection } from '~/settings_panels'; + +jest.mock('~/settings_panels'); + +describe('search_settings/mount', () => { + let app; + + beforeEach(() => { + const el = document.createElement('div'); + + setHTMLFixture('<div id="content-body"></div>'); + + app = mount({ el }); + }); + + afterEach(() => { + app.$destroy(); + }); + + it('calls settings_panel.onExpand when expand event is emitted', () => { + const section = { name: 'section' }; + app.$refs.searchSettings.$emit('expand', section); + + expect(expandSection).toHaveBeenCalledWith($(section)); + }); + + it('calls settings_panel.closeSection when collapse event is emitted', () => { + const section = { name: 'section' }; + app.$refs.searchSettings.$emit('collapse', section); + + expect(closeSection).toHaveBeenCalledWith($(section)); + }); +}); |