2018-11-30 03:48:47 -05:00
|
|
|
import Vue from 'vue';
|
2019-12-09 07:07:58 -05:00
|
|
|
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
|
2019-08-11 19:57:30 -04:00
|
|
|
import { createStore } from '~/mr_notes/stores';
|
2018-11-30 03:48:47 -05:00
|
|
|
import DiffTableCell from '~/diffs/components/diff_table_cell.vue';
|
|
|
|
import diffFileMockData from '../mock_data/diff_file';
|
|
|
|
|
|
|
|
describe('DiffTableCell', () => {
|
|
|
|
const createComponent = options =>
|
2019-08-11 19:57:30 -04:00
|
|
|
createComponentWithStore(Vue.extend(DiffTableCell), createStore(), {
|
2018-11-30 03:48:47 -05:00
|
|
|
line: diffFileMockData.highlighted_diff_lines[0],
|
|
|
|
fileHash: diffFileMockData.file_hash,
|
|
|
|
contextLinesPath: 'contextLinesPath',
|
|
|
|
...options,
|
|
|
|
}).$mount();
|
|
|
|
|
|
|
|
it('does not highlight row when isHighlighted prop is false', done => {
|
|
|
|
const vm = createComponent({ isHighlighted: false });
|
|
|
|
|
|
|
|
vm.$nextTick()
|
|
|
|
.then(() => {
|
|
|
|
expect(vm.$el.classList).not.toContain('hll');
|
|
|
|
})
|
|
|
|
.then(done)
|
|
|
|
.catch(done.fail);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('highlights row when isHighlighted prop is true', done => {
|
|
|
|
const vm = createComponent({ isHighlighted: true });
|
|
|
|
|
|
|
|
vm.$nextTick()
|
|
|
|
.then(() => {
|
|
|
|
expect(vm.$el.classList).toContain('hll');
|
|
|
|
})
|
|
|
|
.then(done)
|
|
|
|
.catch(done.fail);
|
|
|
|
});
|
|
|
|
});
|