summaryrefslogtreecommitdiff
path: root/spec/javascripts/graphs/stat_graph_contributors_spec.js
blob: e03114c1cc5a76155c983659234a6a2d8d2b4339 (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
import ContributorsStatGraph from '~/pages/projects/graphs/show/stat_graph_contributors';
import { ContributorsGraph } from '~/pages/projects/graphs/show/stat_graph_contributors_graph';

import { setLanguage } from '../helpers/locale_helper';

describe('ContributorsStatGraph', () => {
  describe('change_date_header', () => {
    beforeAll(() => {
      setLanguage('de');
    });

    afterAll(() => {
      setLanguage(null);
    });

    it('uses the locale to display date ranges', () => {
      ContributorsGraph.init_x_domain([{ date: '2013-01-31' }, { date: '2012-01-31' }]);
      setFixtures('<div id="date_header"></div>');
      const graph = new ContributorsStatGraph();

      graph.change_date_header();

      expect(document.getElementById('date_header').innerText).toBe('31. Januar 2012 – 31. Januar 2013');
    });
  });
});