Commit 7fc62602 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'xanf-vtu-30-outdated-search' into 'master'

Always invoke find on updated Vue tree

Closes #181842

See merge request gitlab-org/gitlab!22288
parents 578d8700 c0c1e3d3
...@@ -348,11 +348,10 @@ describe('Time series component', () => { ...@@ -348,11 +348,10 @@ describe('Time series component', () => {
glChartComponents.forEach(dynamicComponent => { glChartComponents.forEach(dynamicComponent => {
describe(`GitLab UI: ${dynamicComponent.chartType}`, () => { describe(`GitLab UI: ${dynamicComponent.chartType}`, () => {
let timeSeriesAreaChart; let timeSeriesAreaChart;
let glChart; const findChart = () => timeSeriesAreaChart.find(dynamicComponent.component);
beforeEach(done => { beforeEach(done => {
timeSeriesAreaChart = makeTimeSeriesChart(mockGraphData, dynamicComponent.chartType); timeSeriesAreaChart = makeTimeSeriesChart(mockGraphData, dynamicComponent.chartType);
glChart = timeSeriesAreaChart.find(dynamicComponent.component);
timeSeriesAreaChart.vm.$nextTick(done); timeSeriesAreaChart.vm.$nextTick(done);
}); });
...@@ -361,12 +360,12 @@ describe('Time series component', () => { ...@@ -361,12 +360,12 @@ describe('Time series component', () => {
}); });
it('is a Vue instance', () => { it('is a Vue instance', () => {
expect(glChart.exists()).toBe(true); expect(findChart().exists()).toBe(true);
expect(glChart.isVueInstance()).toBe(true); expect(findChart().isVueInstance()).toBe(true);
}); });
it('receives data properties needed for proper chart render', () => { it('receives data properties needed for proper chart render', () => {
const props = glChart.props(); const props = findChart().props();
expect(props.data).toBe(timeSeriesAreaChart.vm.chartData); expect(props.data).toBe(timeSeriesAreaChart.vm.chartData);
expect(props.option).toBe(timeSeriesAreaChart.vm.chartOptions); expect(props.option).toBe(timeSeriesAreaChart.vm.chartOptions);
...@@ -379,7 +378,9 @@ describe('Time series component', () => { ...@@ -379,7 +378,9 @@ describe('Time series component', () => {
timeSeriesAreaChart.vm.tooltip.title = mockTitle; timeSeriesAreaChart.vm.tooltip.title = mockTitle;
timeSeriesAreaChart.vm.$nextTick(() => { timeSeriesAreaChart.vm.$nextTick(() => {
expect(shallowWrapperContainsSlotText(glChart, 'tooltipTitle', mockTitle)).toBe(true); expect(shallowWrapperContainsSlotText(findChart(), 'tooltipTitle', mockTitle)).toBe(
true,
);
done(); done();
}); });
}); });
...@@ -394,7 +395,9 @@ describe('Time series component', () => { ...@@ -394,7 +395,9 @@ describe('Time series component', () => {
}); });
it('uses deployment title', () => { it('uses deployment title', () => {
expect(shallowWrapperContainsSlotText(glChart, 'tooltipTitle', 'Deployed')).toBe(true); expect(shallowWrapperContainsSlotText(findChart(), 'tooltipTitle', 'Deployed')).toBe(
true,
);
}); });
it('renders clickable commit sha in tooltip content', done => { it('renders clickable commit sha in tooltip content', done => {
......
...@@ -97,10 +97,10 @@ describe('table registry', () => { ...@@ -97,10 +97,10 @@ describe('table registry', () => {
it('selecting all checkbox should select all rows and enable delete button', done => { it('selecting all checkbox should select all rows and enable delete button', done => {
const selectAll = findSelectAllCheckbox(); const selectAll = findSelectAllCheckbox();
const checkboxes = findSelectCheckboxes();
selectAll.trigger('click'); selectAll.trigger('click');
Vue.nextTick(() => { Vue.nextTick(() => {
const checkboxes = findSelectCheckboxes();
const checked = checkboxes.filter(w => w.element.checked); const checked = checkboxes.filter(w => w.element.checked);
expect(checked.length).toBe(checkboxes.length); expect(checked.length).toBe(checkboxes.length);
done(); done();
......
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