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

nav_item_link_spec.js « components « super_sidebar « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5cc1bd01d0feb86139b8fb1e9e26314cffdd0c0f (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
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import NavItemLink from '~/super_sidebar/components/nav_item_link.vue';

describe('NavItemLink component', () => {
  let wrapper;

  const createWrapper = (item) => {
    wrapper = shallowMountExtended(NavItemLink, {
      propsData: {
        item,
      },
    });
  };

  describe('when `item` has `is_active` set to `false`', () => {
    it('renders an anchor tag without active CSS class and `aria-current` attribute', () => {
      createWrapper({ title: 'foo', link: '/foo', is_active: false });

      expect(wrapper.attributes()).toEqual({
        href: '/foo',
        class: '',
      });
    });
  });

  describe('when `item` has `is_active` set to `true`', () => {
    it('renders an anchor tag with active CSS class and `aria-current="page"`', () => {
      createWrapper({ title: 'foo', link: '/foo', is_active: true });

      expect(wrapper.attributes()).toEqual({
        href: '/foo',
        class: 'gl-bg-t-gray-a-08',
        'aria-current': 'page',
      });
    });
  });
});