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

utils_spec.js « profile « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 43537afe169ea1f184e4968f5762a91d984b5032 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { getVisibleCalendarPeriod } from '~/profile/utils';
import { CALENDAR_PERIOD_12_MONTHS, CALENDAR_PERIOD_6_MONTHS } from '~/profile/constants';

describe('getVisibleCalendarPeriod', () => {
  it.each`
    width   | expected
    ${1000} | ${CALENDAR_PERIOD_12_MONTHS}
    ${900}  | ${CALENDAR_PERIOD_6_MONTHS}
  `('returns $expected when container width is $width', ({ width, expected }) => {
    const container = document.createElement('div');
    jest.spyOn(container, 'getBoundingClientRect').mockReturnValueOnce({ width });

    expect(getVisibleCalendarPeriod(container)).toBe(expected);
  });
});