Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-12 00:08:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-12 00:08:44 +0300
commita66475b6beb46d77b9ff3fe30453be2d52779048 (patch)
tree39fd943e67dd66b1d734028f5449d8a41c4fe58f /spec/frontend/search
parent48e26d30fd251f87a2e136d8997ef2ec35859e71 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/search')
-rw-r--r--spec/frontend/search/components/state_filter_spec.js31
1 files changed, 27 insertions, 4 deletions
diff --git a/spec/frontend/search/components/state_filter_spec.js b/spec/frontend/search/components/state_filter_spec.js
index 8d203b3946a..26344f2b592 100644
--- a/spec/frontend/search/components/state_filter_spec.js
+++ b/spec/frontend/search/components/state_filter_spec.js
@@ -1,7 +1,12 @@
import { shallowMount } from '@vue/test-utils';
import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
import StateFilter from '~/search/state_filter/components/state_filter.vue';
-import { FILTER_STATES } from '~/search/state_filter/constants';
+import {
+ FILTER_STATES,
+ SCOPES,
+ FILTER_STATES_BY_SCOPE,
+ FILTER_TEXT,
+} from '~/search/state_filter/constants';
import * as urlUtils from '~/lib/utils/url_utility';
jest.mock('~/lib/utils/url_utility', () => ({
@@ -38,10 +43,10 @@ describe('StateFilter', () => {
describe.each`
scope | showStateDropdown
${'issues'} | ${true}
+ ${'merge_requests'} | ${true}
${'projects'} | ${false}
${'milestones'} | ${false}
${'users'} | ${false}
- ${'merge_requests'} | ${false}
${'notes'} | ${false}
${'wiki_blobs'} | ${false}
${'blobs'} | ${false}
@@ -55,11 +60,29 @@ describe('StateFilter', () => {
});
});
+ describe.each`
+ state | label
+ ${FILTER_STATES.ANY.value} | ${FILTER_TEXT}
+ ${FILTER_STATES.OPEN.value} | ${FILTER_STATES.OPEN.label}
+ ${FILTER_STATES.CLOSED.value} | ${FILTER_STATES.CLOSED.label}
+ ${FILTER_STATES.MERGED.value} | ${FILTER_STATES.MERGED.label}
+ `(`filter text`, ({ state, label }) => {
+ describe(`when state is ${state}`, () => {
+ beforeEach(() => {
+ wrapper = createComponent({ scope: 'issues', state });
+ });
+
+ it(`sets dropdown label to ${label}`, () => {
+ expect(findGlDropdown().attributes('text')).toBe(label);
+ });
+ });
+ });
+
describe('Filter options', () => {
it('renders a dropdown item for each filterOption', () => {
expect(findDropdownItemsText()).toStrictEqual(
- Object.keys(FILTER_STATES).map(key => {
- return FILTER_STATES[key].label;
+ FILTER_STATES_BY_SCOPE[SCOPES.ISSUES].map(v => {
+ return v.label;
}),
);
});