blob: c20d3c2745f5525c6b0a27b82790a9ed0926a7fc (
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 { GlIcon } from '@gitlab/ui';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import ContextSwitcherToggle from '~/super_sidebar/components/context_switcher_toggle.vue';
describe('ContextSwitcherToggle component', () => {
let wrapper;
const context = {
id: 1,
title: 'Title',
avatar: '/path/to/avatar.png',
};
const findGlIcon = () => wrapper.getComponent(GlIcon);
const createWrapper = (props = {}) => {
wrapper = shallowMountExtended(ContextSwitcherToggle, {
propsData: {
context,
expanded: false,
...props,
},
});
};
it('renders "chevron-down" icon when not expanded', () => {
createWrapper();
expect(findGlIcon().props('name')).toBe('chevron-down');
});
it('renders "chevron-up" icon when expanded', () => {
createWrapper({
expanded: true,
});
expect(findGlIcon().props('name')).toBe('chevron-up');
});
});
|