Welcome to mirror list, hosted at ThFree Co, Russian Federation.

changed_file_icon_spec.js « components « ide « javascripts « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7308219f705eed057aa204552a39452d01096d72 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
import Vue from 'vue';
import changedFileIcon from '~/ide/components/changed_file_icon.vue';
import createComponent from 'spec/helpers/vue_mount_component_helper';

describe('IDE changed file icon', () => {
  let vm;

  beforeEach(() => {
    const component = Vue.extend(changedFileIcon);

    vm = createComponent(component, {
      file: {
        tempFile: false,
        changed: true,
      },
    });
  });

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

  describe('changedIcon', () => {
    it('equals file-modified when not a temp file and has changes', () => {
      expect(vm.changedIcon).toBe('file-modified');
    });

    it('equals file-addition when a temp file', () => {
      vm.file.tempFile = true;

      expect(vm.changedIcon).toBe('file-addition');
    });
  });

  describe('changedIconClass', () => {
    it('includes ide-file-modified when not a temp file', () => {
      expect(vm.changedIconClass).toContain('ide-file-modified');
    });

    it('includes ide-file-addition when a temp file', () => {
      vm.file.tempFile = true;

      expect(vm.changedIconClass).toContain('ide-file-addition');
    });
  });
});