debian-mirror-gitlab/spec/frontend/confidential_merge_request/components/dropdown_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
961 B
JavaScript
Raw Normal View History

2021-01-03 14:25:43 +05:30
import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
2021-03-11 19:13:27 +05:30
import { mount } from '@vue/test-utils';
2019-09-30 21:07:59 +05:30
import Dropdown from '~/confidential_merge_request/components/dropdown.vue';
let vm;
function factory(projects = []) {
vm = mount(Dropdown, {
propsData: {
projects,
selectedProject: projects[0],
},
});
}
describe('Confidential merge request project dropdown component', () => {
afterEach(() => {
vm.destroy();
});
it('renders dropdown items', () => {
factory([
{
id: 1,
name: 'test',
},
{
id: 2,
name: 'test',
},
]);
2022-10-11 01:57:18 +05:30
expect(vm.findAllComponents(GlDropdownItem).length).toBe(2);
2019-09-30 21:07:59 +05:30
});
2021-01-03 14:25:43 +05:30
it('shows lock icon', () => {
factory();
2022-10-11 01:57:18 +05:30
expect(vm.findComponent(GlDropdown).props('icon')).toBe('lock');
2021-01-03 14:25:43 +05:30
});
it('has dropdown text', () => {
factory();
2019-09-30 21:07:59 +05:30
2022-10-11 01:57:18 +05:30
expect(vm.findComponent(GlDropdown).props('text')).toBe('Select private project');
2019-09-30 21:07:59 +05:30
});
});