summaryrefslogtreecommitdiff
path: root/spec/javascripts/vue_common_components/commit_spec.js.es6
blob: d5a2c5173bdb260c0bd717ac1c479df91ecbd5fe (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*= require vue_common_components/commit */
/* eslint-disable */

describe('Commit component', () => {
  const getRenderedText = (Component, propsData) => {
    const Constructor = Vue.extend(Component);
    const vm = new Constructor({propsData}).$mount();    
    return vm.$el.textContent;
  };
  
  const MyComponent = window.gl.commitComponent;

  describe('When `ref` is provided', () => {
    const props = {
      tag: true,
      ref: {
        name: 'master',
        ref_url: 'http://localhost/namespace2/gitlabhq/tree/master'
      },
      commit_url: 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067',
      short_sha: 'b7836edd',
      title: 'Commit message',
      author: {
        avatar_url: 'https://gitlab.com/uploads/user/avatar/300478/avatar.png',
        web_url: 'https://gitlab.com/jschatz1',
        username: 'jschatz1'
      }
    };

    it('should render a tag icon if it represents a tag', () => {
      const renderedText = getRenderedText(MyComponent, props);

    });

    it('should render a code-fork icon if it does not represent a tag', () => {

    });

    it('should render a link to the ref url', () => {

    });

    it('should render the ref name', () => {

    });
  });
});

it('should render the commit icon as an svg', () => {

});

it('should render the commit short sha with a link to the commit url', () => {

});

describe('Given commit title and author props', () => {
  it('Should render a link to the author profile', () => {

  });

  it('Should render the author avatar with title and alt attributes', () => {

  });
});

describe('When commit title is not provided', () => {
  it('Should render default message', () => {

  });
});

describe('Given no ref prop', () => {
  it('Should render without errors', () => {

  });
});

describe('Given no title prop', () => {
  it('Should render without errors', () => {

  });
});

describe('Given no author prop', () => {
  it('Should render without errors', () => {

  });
});