summaryrefslogtreecommitdiff
path: root/spec/javascripts/repo/components/commit_sidebar/list_collapsed_spec.js
blob: c4d3866c922afe2f4280f97c823698cea67d0083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import Vue from 'vue';
import store from '~/ide/stores';
import listCollapsed from '~/ide/components/commit_sidebar/list_collapsed.vue';
import { createComponentWithStore } from '../../../helpers/vue_mount_component_helper';
import { file } from '../../helpers';

describe('Multi-file editor commit sidebar list collapsed', () => {
  let vm;

  beforeEach(() => {
    const Component = Vue.extend(listCollapsed);

    vm = createComponentWithStore(Component, store);

    vm.$store.state.openFiles.push(file(), file());
    vm.$store.state.openFiles[0].tempFile = true;
    vm.$store.state.openFiles.forEach((f) => {
      Object.assign(f, {
        changed: true,
      });
    });

    vm.$mount();
  });

  afterEach(() => {
    vm.$destroy();
  });

  it('renders added & modified files count', () => {
    expect(vm.$el.textContent.replace(/\s+/g, ' ').trim()).toBe('1 1');
  });
});