summaryrefslogtreecommitdiff
path: root/spec/frontend
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-30 18:09:47 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-30 18:09:47 +0000
commitcd99e8611a6df11975c227517892606440ad3ff6 (patch)
treeaea53bef850be971e128b4be9649654d760b2b02 /spec/frontend
parent412fe7ab5511ec446f250d415d571108fe838b68 (diff)
downloadgitlab-ce-cd99e8611a6df11975c227517892606440ad3ff6.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/pages/search/show/__snapshots__/refresh_counts_spec.js.snap7
-rw-r--r--spec/frontend/pages/search/show/refresh_counts_spec.js43
-rw-r--r--spec/frontend/search/sidebar/components/app_spec.js23
-rw-r--r--spec/frontend/search/sidebar/components/confidentiality_filter_spec.js20
-rw-r--r--spec/frontend/search/sidebar/components/status_filter_spec.js20
5 files changed, 7 insertions, 106 deletions
diff --git a/spec/frontend/pages/search/show/__snapshots__/refresh_counts_spec.js.snap b/spec/frontend/pages/search/show/__snapshots__/refresh_counts_spec.js.snap
deleted file mode 100644
index ce456d6c899..00000000000
--- a/spec/frontend/pages/search/show/__snapshots__/refresh_counts_spec.js.snap
+++ /dev/null
@@ -1,7 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`pages/search/show/refresh_counts fetches and displays search counts 1`] = `
-"<div class=\\"badge\\">22</div>
-<div class=\\"badge js-search-count\\" data-url=\\"http://test.host/search/count?search=lorem+ipsum&amp;project_id=3&amp;scope=issues\\">4</div>
-<div class=\\"badge js-search-count\\" data-url=\\"http://test.host/search/count?search=lorem+ipsum&amp;project_id=3&amp;scope=merge_requests\\">5</div>"
-`;
diff --git a/spec/frontend/pages/search/show/refresh_counts_spec.js b/spec/frontend/pages/search/show/refresh_counts_spec.js
deleted file mode 100644
index 6f14f0c70bd..00000000000
--- a/spec/frontend/pages/search/show/refresh_counts_spec.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import MockAdapter from 'axios-mock-adapter';
-import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
-import { TEST_HOST } from 'helpers/test_constants';
-import axios from '~/lib/utils/axios_utils';
-import refreshCounts from '~/pages/search/show/refresh_counts';
-
-const URL = `${TEST_HOST}/search/count?search=lorem+ipsum&project_id=3`;
-const urlWithScope = (scope) => `${URL}&scope=${scope}`;
-const counts = [
- { scope: 'issues', count: 4 },
- { scope: 'merge_requests', count: 5 },
-];
-const fixture = `<div class="badge">22</div>
-<div class="badge js-search-count hidden" data-url="${urlWithScope('issues')}"></div>
-<div class="badge js-search-count hidden" data-url="${urlWithScope('merge_requests')}"></div>`;
-
-describe('pages/search/show/refresh_counts', () => {
- let mock;
-
- beforeEach(() => {
- mock = new MockAdapter(axios);
- setHTMLFixture(fixture);
- });
-
- afterEach(() => {
- resetHTMLFixture();
- });
-
- afterEach(() => {
- mock.restore();
- });
-
- it('fetches and displays search counts', () => {
- counts.forEach(({ scope, count }) => {
- mock.onGet(urlWithScope(scope)).reply(200, { count });
- });
-
- // assert before act behavior
- return refreshCounts().then(() => {
- expect(document.body.innerHTML).toMatchSnapshot();
- });
- });
-});
diff --git a/spec/frontend/search/sidebar/components/app_spec.js b/spec/frontend/search/sidebar/components/app_spec.js
index e87217950cd..6aa40b7a2be 100644
--- a/spec/frontend/search/sidebar/components/app_spec.js
+++ b/spec/frontend/search/sidebar/components/app_spec.js
@@ -84,23 +84,14 @@ describe('GlobalSearchSidebar', () => {
expect(findFilters().exists()).toBe(true);
});
});
- });
-
- describe('when search_page_vertical_nav is enabled', () => {
- beforeEach(() => {
- createComponent({}, { searchPageVerticalNav: true });
- });
- it('shows the vertical navigation', () => {
- expect(findSidebarNavigation().exists()).toBe(true);
- });
- });
- describe('when search_page_vertical_nav is disabled', () => {
- beforeEach(() => {
- createComponent({}, { searchPageVerticalNav: false });
- });
- it('hides the vertical navigation', () => {
- expect(findSidebarNavigation().exists()).toBe(false);
+ describe('renders navigation', () => {
+ beforeEach(() => {
+ createComponent({});
+ });
+ it('shows the vertical navigation', () => {
+ expect(findSidebarNavigation().exists()).toBe(true);
+ });
});
});
});
diff --git a/spec/frontend/search/sidebar/components/confidentiality_filter_spec.js b/spec/frontend/search/sidebar/components/confidentiality_filter_spec.js
index d5ecca4636c..4f146757454 100644
--- a/spec/frontend/search/sidebar/components/confidentiality_filter_spec.js
+++ b/spec/frontend/search/sidebar/components/confidentiality_filter_spec.js
@@ -22,24 +22,4 @@ describe('ConfidentialityFilter', () => {
expect(findRadioFilter().exists()).toBe(true);
});
});
-
- describe.each`
- hasFeatureFlagEnabled | paddingClass
- ${true} | ${'gl-px-5'}
- ${false} | ${'gl-px-0'}
- `(`RadioFilter`, ({ hasFeatureFlagEnabled, paddingClass }) => {
- beforeEach(() => {
- createComponent({
- provide: {
- glFeatures: {
- searchPageVerticalNav: hasFeatureFlagEnabled,
- },
- },
- });
- });
-
- it(`has ${paddingClass} class`, () => {
- expect(findRadioFilter().classes(paddingClass)).toBe(true);
- });
- });
});
diff --git a/spec/frontend/search/sidebar/components/status_filter_spec.js b/spec/frontend/search/sidebar/components/status_filter_spec.js
index 2ed199469e6..6704634ef36 100644
--- a/spec/frontend/search/sidebar/components/status_filter_spec.js
+++ b/spec/frontend/search/sidebar/components/status_filter_spec.js
@@ -22,24 +22,4 @@ describe('StatusFilter', () => {
expect(findRadioFilter().exists()).toBe(true);
});
});
-
- describe.each`
- hasFeatureFlagEnabled | paddingClass
- ${true} | ${'gl-px-5'}
- ${false} | ${'gl-px-0'}
- `(`RadioFilter`, ({ hasFeatureFlagEnabled, paddingClass }) => {
- beforeEach(() => {
- createComponent({
- provide: {
- glFeatures: {
- searchPageVerticalNav: hasFeatureFlagEnabled,
- },
- },
- });
- });
-
- it(`has ${paddingClass} class`, () => {
- expect(findRadioFilter().classes(paddingClass)).toBe(true);
- });
- });
});