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

57 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-09-30 21:07:59 +05:30
import { mount } from '@vue/test-utils';
2020-10-24 23:57:45 +05:30
import { GlDeprecatedDropdownItem } from '@gitlab/ui';
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',
},
]);
2020-10-24 23:57:45 +05:30
expect(vm.findAll(GlDeprecatedDropdownItem).length).toBe(2);
2019-09-30 21:07:59 +05:30
});
it('renders selected project icon', () => {
factory([
{
id: 1,
name: 'test',
},
{
id: 2,
name: 'test 2',
},
]);
expect(vm.find('.js-active-project-check').classes()).not.toContain('icon');
expect(
vm
.findAll('.js-active-project-check')
.at(1)
.classes(),
).toContain('icon');
});
});