summaryrefslogtreecommitdiff
path: root/spec/frontend/vue_mr_widget/test_extension.js
blob: 65c1bd8473be32bcf0ae99c18431a53758748c45 (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
import { EXTENSION_ICONS } from '~/vue_merge_request_widget/constants';

export default {
  name: 'WidgetTestExtension',
  props: ['targetProjectFullPath'],
  expandEvent: 'test_expand_event',
  computed: {
    summary({ count, targetProjectFullPath }) {
      return `Test extension summary count: ${count} & ${targetProjectFullPath}`;
    },
    statusIcon({ count }) {
      return count > 0 ? EXTENSION_ICONS.warning : EXTENSION_ICONS.success;
    },
  },
  methods: {
    fetchCollapsedData({ targetProjectFullPath }) {
      return Promise.resolve({ targetProjectFullPath, count: 1 });
    },
    fetchFullData() {
      return Promise.resolve([
        {
          id: 1,
          text: 'Hello world',
          icon: {
            name: EXTENSION_ICONS.failed,
          },
          badge: {
            text: 'Closed',
          },
          link: {
            href: 'https://gitlab.com',
            text: 'GitLab.com',
          },
          actions: [{ text: 'Full report', href: 'https://gitlab.com', target: '_blank' }],
        },
      ]);
    },
  },
};