Commit d5364c3c authored by Fernando's avatar Fernando

Migrate dropdown to gl-dropdown for fuzzing artifacts

* Udpate unit tests
parent cbe15fff
<script> <script>
import { GlButton, GlDropdown, GlDeprecatedDropdownItem } from '@gitlab/ui'; import { GlButton, GlDropdown, GlDropdownItem } from '@gitlab/ui';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
export default { export default {
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
components: { components: {
GlButton, GlButton,
GlDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
}, },
props: { props: {
jobs: { jobs: {
...@@ -46,12 +46,9 @@ export default { ...@@ -46,12 +46,9 @@ export default {
category="secondary" category="secondary"
size="small" size="small"
> >
<gl-deprecated-dropdown-item <gl-dropdown-item v-for="job in jobs" :key="job.id" :href="artifactDownloadUrl(job)">{{
v-for="job in jobs" job.name
:key="job.id" }}</gl-dropdown-item>
:href="artifactDownloadUrl(job)"
>{{ job.name }}</gl-deprecated-dropdown-item
>
</gl-dropdown> </gl-dropdown>
<gl-button <gl-button
v-else v-else
......
import { GlButton, GlDropdown, GlDeprecatedDropdownItem } from '@gitlab/ui'; import { GlButton, GlDropdown, GlDropdownItem } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import FuzzingArtifactsDownload from 'ee/security_dashboard/components/fuzzing_artifacts_download.vue'; import FuzzingArtifactsDownload from 'ee/security_dashboard/components/fuzzing_artifacts_download.vue';
...@@ -60,11 +60,11 @@ describe('Filter component', () => { ...@@ -60,11 +60,11 @@ describe('Filter component', () => {
it('should render a dropdown button with several items', () => { it('should render a dropdown button with several items', () => {
expect(wrapper.find(GlButton).exists()).toBe(false); expect(wrapper.find(GlButton).exists()).toBe(false);
expect(wrapper.find(GlDropdown).exists()).toBe(true); expect(wrapper.find(GlDropdown).exists()).toBe(true);
expect(wrapper.findAll(GlDeprecatedDropdownItem).length).toBe(2); expect(wrapper.findAll(GlDropdownItem).length).toBe(2);
}); });
it('should render with href set to the correct filepath for every element', () => { it('should render with href set to the correct filepath for every element', () => {
const wrapperArray = wrapper.findAll(GlDeprecatedDropdownItem); const wrapperArray = wrapper.findAll(GlDropdownItem);
wrapperArray.wrappers.forEach((_, index) => { wrapperArray.wrappers.forEach((_, index) => {
const href = `/api/v4/projects/${projectId}/jobs/artifacts/${ const href = `/api/v4/projects/${projectId}/jobs/artifacts/${
jobs[index].ref jobs[index].ref
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment