Commit c875ed90 authored by Scott Stern's avatar Scott Stern Committed by Kushal Pandya

Move boards_filtered_search to have an ee component

parent e2584438
<script> <script>
import { GlFilteredSearchToken } from '@gitlab/ui'; import { GlFilteredSearchToken } from '@gitlab/ui';
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import BoardFilteredSearch from '~/boards/components/board_filtered_search.vue'; import BoardFilteredSearch from 'ee_else_ce/boards/components/board_filtered_search.vue';
import { BoardType } from '~/boards/constants'; import { BoardType } from '~/boards/constants';
import issueBoardFilters from '~/boards/issue_board_filters'; import issueBoardFilters from '~/boards/issue_board_filters';
import { TYPE_USER } from '~/graphql_shared/constants'; import { TYPE_USER } from '~/graphql_shared/constants';
......
<script>
import BoardFilteredSearchCe from '~/boards/components/board_filtered_search.vue';
export default {
components: { BoardFilteredSearchCe },
props: {
tokens: {
required: true,
type: Array,
},
},
};
</script>
<template>
<board-filtered-search-ce v-bind="{ ...$props, ...$attrs }" />
</template>
<script> <script>
import BoardFilteredSearch from '~/boards/components/board_filtered_search.vue'; import BoardFilteredSearch from 'ee/boards/components/board_filtered_search.vue';
import issueBoardFilter from '~/boards/issue_board_filters'; import issueBoardFilter from '~/boards/issue_board_filters';
import { TYPE_USER } from '~/graphql_shared/constants'; import { TYPE_USER } from '~/graphql_shared/constants';
import { convertToGraphQLId } from '~/graphql_shared/utils'; import { convertToGraphQLId } from '~/graphql_shared/utils';
......
import { shallowMount } from '@vue/test-utils';
import BoardFilteredSearch from 'ee/boards/components/board_filtered_search.vue';
import BoardFilteredSearchCe from '~/boards/components/board_filtered_search.vue';
describe('ee/BoardFilteredSearch', () => {
let wrapper;
const createComponent = () => {
wrapper = shallowMount(BoardFilteredSearch, { propsData: { tokens: [] } });
};
const findFilteredSearch = () => wrapper.findComponent(BoardFilteredSearchCe);
afterEach(() => {
wrapper.destroy();
});
describe('default', () => {
beforeEach(() => {
createComponent();
});
it('renders FilteredSearch', () => {
expect(findFilteredSearch().exists()).toBe(true);
});
});
});
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import EpicFilteredSearch from 'ee_component/boards/components/epic_filtered_search.vue'; import EpicFilteredSearch from 'ee/boards/components/epic_filtered_search.vue';
import BoardFilteredSearch from '~/boards/components/board_filtered_search.vue'; import BoardFilteredSearch from 'ee/boards/components/board_filtered_search.vue';
import issueBoardFilters from '~/boards/issue_board_filters'; import issueBoardFilters from '~/boards/issue_board_filters';
import { __ } from '~/locale'; import { __ } from '~/locale';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import BoardFilteredSearch from '~/boards/components/board_filtered_search.vue'; import BoardFilteredSearch from 'ee/boards/components/board_filtered_search.vue';
import IssueBoardFilteredSpec from 'ee/boards/components/issue_board_filtered_search.vue'; import IssueBoardFilteredSpec from 'ee/boards/components/issue_board_filtered_search.vue';
import issueBoardFilters from '~/boards/issue_board_filters'; import issueBoardFilters from '~/boards/issue_board_filters';
import { mockTokens } from '../mock_data'; import { mockTokens } from '../mock_data';
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import BoardFilteredSearch from '~/boards/components/board_filtered_search.vue'; import BoardFilteredSearch from 'ee_else_ce/boards/components/board_filtered_search.vue';
import IssueBoardFilteredSpec from '~/boards/components/issue_board_filtered_search.vue'; import IssueBoardFilteredSpec from '~/boards/components/issue_board_filtered_search.vue';
import issueBoardFilters from '~/boards/issue_board_filters'; import issueBoardFilters from '~/boards/issue_board_filters';
import { mockTokens } from '../mock_data'; import { mockTokens } from '../mock_data';
...@@ -9,6 +9,8 @@ jest.mock('~/boards/issue_board_filters'); ...@@ -9,6 +9,8 @@ jest.mock('~/boards/issue_board_filters');
describe('IssueBoardFilter', () => { describe('IssueBoardFilter', () => {
let wrapper; let wrapper;
const findBoardsFilteredSearch = () => wrapper.findComponent(BoardFilteredSearch);
const createComponent = ({ epicFeatureAvailable = false } = {}) => { const createComponent = ({ epicFeatureAvailable = false } = {}) => {
wrapper = shallowMount(IssueBoardFilteredSpec, { wrapper = shallowMount(IssueBoardFilteredSpec, {
propsData: { fullPath: 'gitlab-org', boardType: 'group' }, propsData: { fullPath: 'gitlab-org', boardType: 'group' },
...@@ -40,13 +42,13 @@ describe('IssueBoardFilter', () => { ...@@ -40,13 +42,13 @@ describe('IssueBoardFilter', () => {
}); });
it('finds BoardFilteredSearch', () => { it('finds BoardFilteredSearch', () => {
expect(wrapper.find(BoardFilteredSearch).exists()).toBe(true); expect(findBoardsFilteredSearch().exists()).toBe(true);
}); });
it('passes the correct tokens to BoardFilteredSearch', () => { it('passes the correct tokens to BoardFilteredSearch', () => {
const tokens = mockTokens(fetchLabelsSpy, fetchAuthorsSpy, wrapper.vm.fetchMilestones); const tokens = mockTokens(fetchLabelsSpy, fetchAuthorsSpy, wrapper.vm.fetchMilestones);
expect(wrapper.find(BoardFilteredSearch).props('tokens')).toEqual(tokens); expect(findBoardsFilteredSearch().props('tokens')).toEqual(tokens);
}); });
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment