Commit c0773cdd authored by Illya Klymov's avatar Illya Klymov

Replace deprecated usage of find/findAll in ee/spec/frontend/boards

* migrate to proper use of findComponent/findAllComponents
parent 68755b38
......@@ -114,8 +114,8 @@ describe('Board card component', () => {
createComponent({ groupId: 1 });
expect(wrapper.findAll(GlLabel)).toHaveLength(3);
expect(wrapper.find(GlLabel).props('title')).toContain(title);
expect(wrapper.findAllComponents(GlLabel)).toHaveLength(3);
expect(wrapper.findComponent(GlLabel).props('title')).toContain(title);
});
it('shows no labels when the isShowingLabels state is false', () => {
......@@ -130,7 +130,7 @@ describe('Board card component', () => {
it('shows weight component', () => {
createComponent();
expect(wrapper.find(IssueCardWeight).exists()).toBe(true);
expect(wrapper.findComponent(IssueCardWeight).exists()).toBe(true);
});
});
});
......@@ -49,11 +49,11 @@ describe('ee/BoardContent', () => {
});
it(`renders BoardContentSidebar = ${resultIssue}`, () => {
expect(wrapper.find(BoardContentSidebar).exists()).toBe(resultIssue);
expect(wrapper.findComponent(BoardContentSidebar).exists()).toBe(resultIssue);
});
it(`renders EpicBoardContentSidebar = ${resultEpic}`, () => {
expect(wrapper.find(EpicBoardContentSidebar).exists()).toBe(resultEpic);
expect(wrapper.findComponent(EpicBoardContentSidebar).exists()).toBe(resultEpic);
});
});
});
......@@ -106,7 +106,7 @@ describe('Board List Header Component', () => {
});
};
const findSettingsButton = () => wrapper.find({ ref: 'settingsBtn' });
const findSettingsButton = () => wrapper.findComponent({ ref: 'settingsBtn' });
const findIterationPeriod = () => wrapper.find('[data-testid="board-list-iteration-period"]');
afterEach(() => {
......@@ -211,7 +211,7 @@ describe('Board List Header Component', () => {
await waitForPromises();
const weightTooltip = wrapper.find({ ref: 'weightTooltip' });
const weightTooltip = wrapper.findComponent({ ref: 'weightTooltip' });
expect(weightTooltip.exists()).toBe(true);
expect(weightTooltip.text()).toContain(boardListQueryResponse().data.boardList.totalWeight);
......@@ -220,7 +220,7 @@ describe('Board List Header Component', () => {
it('weightFeatureAvailable is false', () => {
createComponent();
expect(wrapper.find({ ref: 'weightTooltip' }).exists()).toBe(false);
expect(wrapper.findComponent({ ref: 'weightTooltip' }).exists()).toBe(false);
});
});
......
......@@ -61,16 +61,18 @@ describe('BoardSettingsListType', () => {
it('renders gl-avatar-link with correct href', () => {
createComponent({ activeId: 1, boardListType: 'assignee' });
expect(wrapper.find(GlAvatarLink).exists()).toBe(true);
expect(wrapper.find(GlAvatarLink).attributes('href')).toBe('https://gitlab.com/root');
expect(wrapper.findComponent(GlAvatarLink).exists()).toBe(true);
expect(wrapper.findComponent(GlAvatarLink).attributes('href')).toBe(
'https://gitlab.com/root',
);
});
it('renders gl-avatar-labeled with "root" as username and name as "root"', () => {
createComponent({ activeId: 1, boardListType: 'assignee' });
expect(wrapper.find(GlAvatarLabeled).exists()).toBe(true);
expect(wrapper.find(GlAvatarLabeled).attributes('label')).toBe('root');
expect(wrapper.find(GlAvatarLabeled).attributes('sublabel')).toBe('@root');
expect(wrapper.findComponent(GlAvatarLabeled).exists()).toBe(true);
expect(wrapper.findComponent(GlAvatarLabeled).attributes('label')).toBe('root');
expect(wrapper.findComponent(GlAvatarLabeled).attributes('sublabel')).toBe('@root');
});
it('renders the correct list type text', () => {
......
......@@ -18,7 +18,7 @@ describe('BoardSettingsWipLimit', () => {
const clickEdit = () => wrapper.find('.js-edit-button').vm.$emit('click');
const findRemoveWipLimit = () => wrapper.find('.js-remove-limit');
const findWipLimit = () => wrapper.find('.js-wip-limit');
const findInput = () => wrapper.find(GlFormInput);
const findInput = () => wrapper.findComponent(GlFormInput);
const createComponent = ({
vuexState = { activeId: listId },
......
......@@ -73,7 +73,7 @@ describe('EpicBoardContentSidebar', () => {
});
it('confirms we render MountingPortal', () => {
expect(wrapper.find(MountingPortal).props()).toMatchObject({
expect(wrapper.findComponent(MountingPortal).props()).toMatchObject({
mountTo: '#js-right-sidebar-portal',
append: true,
name: 'epic-board-sidebar',
......@@ -111,7 +111,7 @@ describe('EpicBoardContentSidebar', () => {
});
it('renders 2 SidebarDateWidget', () => {
expect(wrapper.findAll(SidebarDateWidget)).toHaveLength(2);
expect(wrapper.findAllComponents(SidebarDateWidget)).toHaveLength(2);
});
it('renders SidebarParticipantsWidget', () => {
......@@ -135,7 +135,7 @@ describe('EpicBoardContentSidebar', () => {
});
it('calls toggleBoardItem with correct parameters', async () => {
wrapper.find(GlDrawer).vm.$emit('close');
wrapper.findComponent(GlDrawer).vm.$emit('close');
expect(toggleBoardItem).toHaveBeenCalledTimes(1);
expect(toggleBoardItem).toHaveBeenCalledWith(expect.any(Object), {
......
......@@ -38,7 +38,7 @@ describe('EpicFilteredSearch', () => {
});
it('finds BoardFilteredSearch', () => {
expect(wrapper.find(BoardFilteredSearch).exists()).toBe(true);
expect(wrapper.findComponent(BoardFilteredSearch).exists()).toBe(true);
});
it('passes tokens to BoardFilteredSearch', () => {
......@@ -73,7 +73,7 @@ describe('EpicFilteredSearch', () => {
],
},
];
expect(wrapper.find(BoardFilteredSearch).props('tokens').toString()).toBe(
expect(wrapper.findComponent(BoardFilteredSearch).props('tokens').toString()).toBe(
orderBy(tokens, ['title']).toString(),
);
});
......
......@@ -82,7 +82,7 @@ describe('EpicLane', () => {
});
it('displays 1 icon', () => {
expect(wrapper.findAll(GlIcon)).toHaveLength(1);
expect(wrapper.findAllComponents(GlIcon)).toHaveLength(1);
});
it('displays epic title', () => {
......@@ -90,17 +90,17 @@ describe('EpicLane', () => {
});
it('renders one IssuesLaneList component per list passed in props', () => {
expect(wrapper.findAll(IssuesLaneList)).toHaveLength(wrapper.props('lists').length);
expect(wrapper.findAllComponents(IssuesLaneList)).toHaveLength(wrapper.props('lists').length);
});
it('hides issues when collapsing', () => {
expect(wrapper.findAll(IssuesLaneList)).toHaveLength(wrapper.props('lists').length);
expect(wrapper.findAllComponents(IssuesLaneList)).toHaveLength(wrapper.props('lists').length);
expect(wrapper.vm.isCollapsed).toBe(false);
findChevronButton().vm.$emit('click');
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.findAll(IssuesLaneList)).toHaveLength(0);
expect(wrapper.findAllComponents(IssuesLaneList)).toHaveLength(0);
expect(wrapper.vm.isCollapsed).toBe(true);
});
});
......
......@@ -140,7 +140,7 @@ describe('EpicsSwimlanes', () => {
it('renders virtual-list', () => {
const virtualList = wrapper.findComponent(VirtualList);
const scrollableContainer = wrapper.find({ ref: 'scrollableContainer' }).element;
const scrollableContainer = wrapper.findComponent({ ref: 'scrollableContainer' }).element;
expect(BoardUtils.calculateSwimlanesBufferSize).toHaveBeenCalledWith(
wrapper.element.offsetTop,
......
......@@ -42,7 +42,7 @@ describe('IssueBoardFilter', () => {
});
it('finds BoardFilteredSearch', () => {
expect(wrapper.find(BoardFilteredSearch).exists()).toBe(true);
expect(wrapper.findComponent(BoardFilteredSearch).exists()).toBe(true);
});
it('passes the correct tokens to BoardFilteredSearch including epics', () => {
......@@ -53,7 +53,9 @@ describe('IssueBoardFilter', () => {
wrapper.vm.fetchIterations,
);
expect(wrapper.find(BoardFilteredSearch).props('tokens')).toEqual(orderBy(tokens, ['title']));
expect(wrapper.findComponent(BoardFilteredSearch).props('tokens')).toEqual(
orderBy(tokens, ['title']),
);
});
});
});
......@@ -57,7 +57,7 @@ describe('IssuesLaneList', () => {
});
it('renders one BoardCard component per issue passed in props', () => {
expect(wrapper.findAll(BoardCard)).toHaveLength(wrapper.props('issues').length);
expect(wrapper.findAllComponents(BoardCard)).toHaveLength(wrapper.props('issues').length);
});
});
......@@ -73,7 +73,7 @@ describe('IssuesLaneList', () => {
});
it('does not renders BoardCard components', () => {
expect(wrapper.findAll(BoardCard)).toHaveLength(0);
expect(wrapper.findAllComponents(BoardCard)).toHaveLength(0);
});
});
......
......@@ -25,13 +25,13 @@ describe('ToggleEpicsSwimlanes', () => {
describe('dropdownLabel', () => {
it('displays "None" when isShowingEpicsSwimlanes is false', () => {
expect(wrapper.find(GlDropdown).props('text')).toEqual('None');
expect(wrapper.findComponent(GlDropdown).props('text')).toEqual('None');
});
it('returns "Epics" when isShowingEpicsSwimlanes is true', () => {
store = new Vuex.Store({ state: { isShowingEpicsSwimlanes: true } });
createComponent();
expect(wrapper.find(GlDropdown).props('text')).toEqual('Epic');
expect(wrapper.findComponent(GlDropdown).props('text')).toEqual('Epic');
});
});
......@@ -45,8 +45,8 @@ describe('ToggleEpicsSwimlanes', () => {
});
it('renders dropdown with 2 options', () => {
expect(wrapper.find(GlDropdown).exists()).toBe(true);
expect(wrapper.findAll(GlDropdownItem).length).toEqual(2);
expect(wrapper.findComponent(GlDropdown).exists()).toBe(true);
expect(wrapper.findAllComponents(GlDropdownItem).length).toEqual(2);
});
});
});
......@@ -5,10 +5,11 @@ import WeightSelect from 'ee/boards/components/weight_select.vue';
describe('WeightSelect', () => {
let wrapper;
const editButton = () => wrapper.find(GlButton);
const editButton = () => wrapper.findComponent(GlButton);
const valueContainer = () => wrapper.find('[data-testid="selected-weight"]');
const weightDropdown = () => wrapper.find(GlDropdown);
const getWeightItemAtIndex = (index) => weightDropdown().findAll(GlDropdownItem).at(index);
const weightDropdown = () => wrapper.findComponent(GlDropdown);
const getWeightItemAtIndex = (index) =>
weightDropdown().findAllComponents(GlDropdownItem).at(index);
const defaultProps = {
weights: ['Any', 'None', 0, 1, 2, 3],
board: {
......
......@@ -38,7 +38,7 @@ describe('ToggleLabels component', () => {
it('onStorageUpdate parses empty value as false', async () => {
wrapper = createComponent();
const localStorageSync = wrapper.find(LocalStorageSync);
const localStorageSync = wrapper.findComponent(LocalStorageSync);
localStorageSync.vm.$emit('input', '');
await wrapper.vm.$nextTick();
......@@ -49,10 +49,10 @@ describe('ToggleLabels component', () => {
it('sets GlToggle value from store.isShowingLabels', () => {
wrapper = createComponent({ isShowingLabels: true });
expect(wrapper.find(GlToggle).props('value')).toEqual(true);
expect(wrapper.findComponent(GlToggle).props('value')).toEqual(true);
wrapper = createComponent({ isShowingLabels: false });
expect(wrapper.find(GlToggle).props('value')).toEqual(false);
expect(wrapper.findComponent(GlToggle).props('value')).toEqual(false);
});
});
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