Commit c0c1e3d3 authored by Illya Klymov's avatar Illya Klymov

Ensure search against actual render tree

parent 8f23a3bb
...@@ -340,11 +340,10 @@ describe('Time series component', () => { ...@@ -340,11 +340,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);
}); });
...@@ -353,12 +352,12 @@ describe('Time series component', () => { ...@@ -353,12 +352,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);
...@@ -371,7 +370,9 @@ describe('Time series component', () => { ...@@ -371,7 +370,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();
}); });
}); });
...@@ -386,7 +387,9 @@ describe('Time series component', () => { ...@@ -386,7 +387,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