diff options
Diffstat (limited to 'spec/frontend/boards/components/board_content_spec.js')
-rw-r--r-- | spec/frontend/boards/components/board_content_spec.js | 75 |
1 files changed, 33 insertions, 42 deletions
diff --git a/spec/frontend/boards/components/board_content_spec.js b/spec/frontend/boards/components/board_content_spec.js index 5a799b6388e..f535679b8a0 100644 --- a/spec/frontend/boards/components/board_content_spec.js +++ b/spec/frontend/boards/components/board_content_spec.js @@ -5,9 +5,10 @@ import Draggable from 'vuedraggable'; import Vuex from 'vuex'; import EpicsSwimlanes from 'ee_component/boards/components/epics_swimlanes.vue'; import getters from 'ee_else_ce/boards/stores/getters'; -import BoardColumnDeprecated from '~/boards/components/board_column_deprecated.vue'; +import BoardColumn from '~/boards/components/board_column.vue'; import BoardContent from '~/boards/components/board_content.vue'; -import { mockLists, mockListsWithModel } from '../mock_data'; +import BoardContentSidebar from '~/boards/components/board_content_sidebar.vue'; +import { mockLists } from '../mock_data'; Vue.use(Vuex); @@ -23,6 +24,7 @@ describe('BoardContent', () => { isShowingEpicsSwimlanes: false, boardLists: mockLists, error: undefined, + issuableType: 'issue', }; const createStore = (state = defaultState) => { @@ -33,25 +35,19 @@ describe('BoardContent', () => { }); }; - const createComponent = ({ - state, - props = {}, - graphqlBoardListsEnabled = false, - canAdminList = true, - } = {}) => { + const createComponent = ({ state, props = {}, canAdminList = true } = {}) => { const store = createStore({ ...defaultState, ...state, }); wrapper = shallowMount(BoardContent, { propsData: { - lists: mockListsWithModel, + lists: mockLists, disabled: false, ...props, }, provide: { canAdminList, - glFeatures: { graphqlBoardLists: graphqlBoardListsEnabled }, }, store, }); @@ -61,53 +57,48 @@ describe('BoardContent', () => { wrapper.destroy(); }); - it('renders a BoardColumnDeprecated component per list', () => { - createComponent(); + describe('default', () => { + beforeEach(() => { + createComponent(); + }); - expect(wrapper.findAllComponents(BoardColumnDeprecated)).toHaveLength( - mockListsWithModel.length, - ); - }); + it('renders a BoardColumn component per list', () => { + expect(wrapper.findAllComponents(BoardColumn)).toHaveLength(mockLists.length); + }); - it('does not display EpicsSwimlanes component', () => { - createComponent(); + it('renders BoardContentSidebar', () => { + expect(wrapper.find(BoardContentSidebar).exists()).toBe(true); + }); - expect(wrapper.find(EpicsSwimlanes).exists()).toBe(false); - expect(wrapper.find(GlAlert).exists()).toBe(false); + it('does not display EpicsSwimlanes component', () => { + expect(wrapper.find(EpicsSwimlanes).exists()).toBe(false); + expect(wrapper.find(GlAlert).exists()).toBe(false); + }); }); - describe('graphqlBoardLists feature flag enabled', () => { + describe('when issuableType is not issue', () => { beforeEach(() => { - createComponent({ graphqlBoardListsEnabled: true }); - gon.features = { - graphqlBoardLists: true, - }; + createComponent({ state: { issuableType: 'foo' } }); }); - describe('can admin list', () => { - beforeEach(() => { - createComponent({ graphqlBoardListsEnabled: true, canAdminList: true }); - }); - - it('renders draggable component', () => { - expect(wrapper.find(Draggable).exists()).toBe(true); - }); + it('does not render BoardContentSidebar', () => { + expect(wrapper.find(BoardContentSidebar).exists()).toBe(false); }); + }); - describe('can not admin list', () => { - beforeEach(() => { - createComponent({ graphqlBoardListsEnabled: true, canAdminList: false }); - }); + describe('can admin list', () => { + beforeEach(() => { + createComponent({ canAdminList: true }); + }); - it('does not render draggable component', () => { - expect(wrapper.find(Draggable).exists()).toBe(false); - }); + it('renders draggable component', () => { + expect(wrapper.find(Draggable).exists()).toBe(true); }); }); - describe('graphqlBoardLists feature flag disabled', () => { + describe('can not admin list', () => { beforeEach(() => { - createComponent({ graphqlBoardListsEnabled: false }); + createComponent({ canAdminList: false }); }); it('does not render draggable component', () => { |