Commit f51844b4 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'xanf-remove-deprecated-methods-from-cycle_analytics' into 'master'

Remove deprecated methods options from specs

See merge request gitlab-org/gitlab!40678
parents fff153c5 747b33cf
...@@ -60,6 +60,9 @@ export default { ...@@ -60,6 +60,9 @@ export default {
mounted() { mounted() {
this.checkIfTitleOverflows(); this.checkIfTitleOverflows();
}, },
updated() {
this.checkIfTitleOverflows();
},
methods: { methods: {
handleDropdownAction(action) { handleDropdownAction(action) {
this.$emit(action); this.$emit(action);
......
import Vuex from 'vuex'; import Vuex from 'vuex';
import { shallowMount, mount, createLocalVue } from '@vue/test-utils'; import { shallowMount, mount, createLocalVue } from '@vue/test-utils';
import { GlLoadingIcon, GlNewDropdownItem } from '@gitlab/ui'; import { GlLoadingIcon, GlNewDropdownItem } from '@gitlab/ui';
import durationChartStore from 'ee/analytics/cycle_analytics/store/modules/duration_chart';
import Scatterplot from 'ee/analytics/shared/components/scatterplot.vue'; import Scatterplot from 'ee/analytics/shared/components/scatterplot.vue';
import DurationChart from 'ee/analytics/cycle_analytics/components/duration_chart.vue'; import DurationChart from 'ee/analytics/cycle_analytics/components/duration_chart.vue';
import StageDropdownFilter from 'ee/analytics/cycle_analytics/components/stage_dropdown_filter.vue'; import StageDropdownFilter from 'ee/analytics/cycle_analytics/components/stage_dropdown_filter.vue';
...@@ -19,7 +18,7 @@ const fakeStore = ({ initialGetters, initialState }) => ...@@ -19,7 +18,7 @@ const fakeStore = ({ initialGetters, initialState }) =>
new Vuex.Store({ new Vuex.Store({
modules: { modules: {
durationChart: { durationChart: {
...durationChartStore, namespaced: true,
getters: { getters: {
durationChartPlottableData: () => durationData, durationChartPlottableData: () => durationData,
...initialGetters, ...initialGetters,
...@@ -28,6 +27,7 @@ const fakeStore = ({ initialGetters, initialState }) => ...@@ -28,6 +27,7 @@ const fakeStore = ({ initialGetters, initialState }) =>
isLoading: false, isLoading: false,
...initialState, ...initialState,
}, },
actions: actionSpies,
}, },
}, },
}); });
...@@ -46,7 +46,6 @@ function createComponent({ ...@@ -46,7 +46,6 @@ function createComponent({
stages, stages,
...props, ...props,
}, },
methods: actionSpies,
stubs: { stubs: {
GlLoadingIcon: true, GlLoadingIcon: true,
Scatterplot: true, Scatterplot: true,
...@@ -102,7 +101,11 @@ describe('DurationChart', () => { ...@@ -102,7 +101,11 @@ describe('DurationChart', () => {
}); });
it('calls the `updateSelectedDurationChartStages` action', () => { it('calls the `updateSelectedDurationChartStages` action', () => {
expect(actionSpies.updateSelectedDurationChartStages).toHaveBeenCalledWith(selectedStages); expect(actionSpies.updateSelectedDurationChartStages).toHaveBeenCalledWith(
expect.any(Object),
selectedStages,
undefined,
);
}); });
}); });
......
...@@ -25,6 +25,10 @@ describe('StageNavItem', () => { ...@@ -25,6 +25,10 @@ describe('StageNavItem', () => {
const findStageTitle = () => wrapper.find({ ref: 'title' }); const findStageTitle = () => wrapper.find({ ref: 'title' });
const findStageMedian = () => wrapper.find({ ref: 'median' }); const findStageMedian = () => wrapper.find({ ref: 'median' });
const findDropdown = () => wrapper.find({ ref: 'dropdown' }); const findDropdown = () => wrapper.find({ ref: 'dropdown' });
const setFakeTitleWidth = value =>
Object.defineProperty(wrapper.find({ ref: 'titleSpan' }).element, 'scrollWidth', {
value,
});
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -79,12 +83,13 @@ describe('StageNavItem', () => { ...@@ -79,12 +83,13 @@ describe('StageNavItem', () => {
data() { data() {
return { isTitleOverflowing: true }; return { isTitleOverflowing: true };
}, },
methods: {
// making tbis a noop so it wont toggle 'isTitleOverflowing' on mount
checkIfTitleOverflows: () => {},
},
}, },
}); });
// JSDom does not calculate scrollWidth / offsetWidth so we fake it
setFakeTitleWidth(1000);
wrapper.vm.$forceUpdate();
return wrapper.vm.$nextTick();
}); });
it('renders the tooltip', () => { it('renders the tooltip', () => {
......
import Vuex from 'vuex'; import Vuex from 'vuex';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import tasksByTypeStore from 'ee/analytics/cycle_analytics/store/modules/type_of_work';
import TypeOfWorkCharts from 'ee/analytics/cycle_analytics/components/type_of_work_charts.vue'; import TypeOfWorkCharts from 'ee/analytics/cycle_analytics/components/type_of_work_charts.vue';
import TasksByTypeChart from 'ee/analytics/cycle_analytics/components/tasks_by_type/tasks_by_type_chart.vue'; import TasksByTypeChart from 'ee/analytics/cycle_analytics/components/tasks_by_type/tasks_by_type_chart.vue';
import TasksByTypeFilters from 'ee/analytics/cycle_analytics/components/tasks_by_type/tasks_by_type_filters.vue'; import TasksByTypeFilters from 'ee/analytics/cycle_analytics/components/tasks_by_type/tasks_by_type_filters.vue';
...@@ -22,7 +21,7 @@ const fakeStore = ({ initialGetters, initialState }) => ...@@ -22,7 +21,7 @@ const fakeStore = ({ initialGetters, initialState }) =>
new Vuex.Store({ new Vuex.Store({
modules: { modules: {
typeOfWork: { typeOfWork: {
...tasksByTypeStore, namespaced: true,
getters: { getters: {
tasksByTypeChartData: () => tasksByTypeData, tasksByTypeChartData: () => tasksByTypeData,
selectedTasksByTypeFilters: () => taskByTypeFilters, selectedTasksByTypeFilters: () => taskByTypeFilters,
...@@ -32,6 +31,7 @@ const fakeStore = ({ initialGetters, initialState }) => ...@@ -32,6 +31,7 @@ const fakeStore = ({ initialGetters, initialState }) =>
state: { state: {
...initialState, ...initialState,
}, },
actions: actionSpies,
}, },
}, },
}); });
...@@ -41,7 +41,6 @@ describe('TypeOfWorkCharts', () => { ...@@ -41,7 +41,6 @@ describe('TypeOfWorkCharts', () => {
return shallowMount(TypeOfWorkCharts, { return shallowMount(TypeOfWorkCharts, {
localVue, localVue,
store: fakeStore({ initialGetters, initialState }), store: fakeStore({ initialGetters, initialState }),
methods: actionSpies,
stubs: { stubs: {
TasksByTypeChart: true, TasksByTypeChart: true,
TasksByTypeFilters: true, TasksByTypeFilters: true,
...@@ -111,7 +110,11 @@ describe('TypeOfWorkCharts', () => { ...@@ -111,7 +110,11 @@ describe('TypeOfWorkCharts', () => {
}); });
it('calls the setTasksByTypeFilters method', () => { it('calls the setTasksByTypeFilters method', () => {
expect(actionSpies.setTasksByTypeFilters).toHaveBeenCalledWith(payload); expect(actionSpies.setTasksByTypeFilters).toHaveBeenCalledWith(
expect.any(Object),
payload,
undefined,
);
}); });
}); });
......
...@@ -25,9 +25,12 @@ describe('ValueStreamSelect', () => { ...@@ -25,9 +25,12 @@ describe('ValueStreamSelect', () => {
selectedValueStream: {}, selectedValueStream: {},
...initialState, ...initialState,
}, },
actions: {
createValueStream: createValueStreamMock,
},
}); });
const createComponent = ({ data = {}, initialState = {}, methods = {} } = {}) => const createComponent = ({ data = {}, initialState = {} } = {}) =>
shallowMount(ValueStreamSelect, { shallowMount(ValueStreamSelect, {
localVue, localVue,
store: fakeStore({ initialState }), store: fakeStore({ initialState }),
...@@ -36,10 +39,6 @@ describe('ValueStreamSelect', () => { ...@@ -36,10 +39,6 @@ describe('ValueStreamSelect', () => {
...data, ...data,
}; };
}, },
methods: {
createValueStream: createValueStreamMock,
...methods,
},
mocks: { mocks: {
$toast: { $toast: {
show: mockToastShow, show: mockToastShow,
...@@ -163,7 +162,11 @@ describe('ValueStreamSelect', () => { ...@@ -163,7 +162,11 @@ describe('ValueStreamSelect', () => {
}); });
it('calls the "createValueStream" event when submitted', () => { it('calls the "createValueStream" event when submitted', () => {
expect(createValueStreamMock).toHaveBeenCalledWith({ name: streamName }); expect(createValueStreamMock).toHaveBeenCalledWith(
expect.any(Object),
{ name: streamName },
undefined,
);
}); });
it('clears the name field', () => { it('clears the name field', () => {
......
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