inline_diff_expansion_row_spec.js 1.02 KB
Newer Older
1
import Vue from 'vue';
2
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
3
import { createStore } from '~/mr_notes/stores';
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
import InlineDiffExpansionRow from '~/diffs/components/inline_diff_expansion_row.vue';
import diffFileMockData from '../mock_data/diff_file';

describe('InlineDiffExpansionRow', () => {
  const matchLine = diffFileMockData.highlighted_diff_lines[5];

  const createComponent = (options = {}) => {
    const cmp = Vue.extend(InlineDiffExpansionRow);
    const defaults = {
      fileHash: diffFileMockData.file_hash,
      contextLinesPath: 'contextLinesPath',
      line: matchLine,
      isTop: false,
      isBottom: false,
    };
    const props = Object.assign({}, defaults, options);

21
    return createComponentWithStore(cmp, createStore(), props).$mount();
22 23 24 25 26 27 28 29 30 31
  };

  describe('template', () => {
    it('should render expansion row for match lines', () => {
      const vm = createComponent();

      expect(vm.$el.classList.contains('line_expansion')).toBe(true);
    });
  });
});