debian-mirror-gitlab/spec/javascripts/diffs/components/diff_table_cell_spec.js

38 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-02-15 15:39:39 +05:30
import Vue from 'vue';
2020-01-01 13:55:28 +05:30
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
2019-10-12 21:52:04 +05:30
import { createStore } from '~/mr_notes/stores';
2019-02-15 15:39:39 +05:30
import DiffTableCell from '~/diffs/components/diff_table_cell.vue';
import diffFileMockData from '../mock_data/diff_file';
describe('DiffTableCell', () => {
const createComponent = options =>
2019-10-12 21:52:04 +05:30
createComponentWithStore(Vue.extend(DiffTableCell), createStore(), {
2019-02-15 15:39:39 +05:30
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);
});
});