Commit 108e99cc authored by Marvin Karegyeya's avatar Marvin Karegyeya Committed by Nathan Friend

Replace GlDeprecatedDropdown with GlDropdown in code_coverage.vue

parent f090988f
<script> <script>
import { import { GlAlert, GlDropdown, GlDropdownItem, GlSprintf } from '@gitlab/ui';
GlAlert,
GlDeprecatedDropdown,
GlDeprecatedDropdownItem,
GlIcon,
GlSprintf,
} from '@gitlab/ui';
import { GlAreaChart } from '@gitlab/ui/dist/charts'; import { GlAreaChart } from '@gitlab/ui/dist/charts';
import dateFormat from 'dateformat'; import dateFormat from 'dateformat';
import { get } from 'lodash'; import { get } from 'lodash';
...@@ -17,9 +11,8 @@ export default { ...@@ -17,9 +11,8 @@ export default {
components: { components: {
GlAlert, GlAlert,
GlAreaChart, GlAreaChart,
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlIcon,
GlSprintf, GlSprintf,
}, },
props: { props: {
...@@ -140,25 +133,18 @@ export default { ...@@ -140,25 +133,18 @@ export default {
{{ __('It seems that there is currently no available data for code coverage') }} {{ __('It seems that there is currently no available data for code coverage') }}
</span> </span>
</gl-alert> </gl-alert>
<gl-deprecated-dropdown v-if="canShowData" :text="selectedDailyCoverageName"> <gl-dropdown v-if="canShowData" :text="selectedDailyCoverageName">
<gl-deprecated-dropdown-item <gl-dropdown-item
v-for="({ group_name }, index) in dailyCoverageData" v-for="({ group_name }, index) in dailyCoverageData"
:key="index" :key="index"
:value="group_name" :value="group_name"
:is-check-item="true"
:is-checked="index === selectedCoverageIndex"
@click="setSelectedCoverage(index)" @click="setSelectedCoverage(index)"
> >
<div class="gl-display-flex">
<gl-icon
v-if="index === selectedCoverageIndex"
name="mobile-issue-close"
class="gl-absolute"
/>
<span class="gl-display-flex align-items-center ml-4">
{{ group_name }} {{ group_name }}
</span> </gl-dropdown-item>
</div> </gl-dropdown>
</gl-deprecated-dropdown-item>
</gl-deprecated-dropdown>
</div> </div>
<gl-area-chart <gl-area-chart
v-if="!isLoading" v-if="!isLoading"
......
---
title: Replace-GlDeprecatedDropdown-with-GlDropdown-in-app/assets/javascripts/pages/projects/graphs/components/code_coverage.vue
merge_request: 41423
author: nuwe1
type: other
...@@ -9,65 +9,54 @@ exports[`Code Coverage when fetching data is successful matches the snapshot 1`] ...@@ -9,65 +9,54 @@ exports[`Code Coverage when fetching data is successful matches the snapshot 1`]
<!----> <!---->
<gl-deprecated-dropdown-stub <gl-dropdown-stub
category="tertiary"
headertext=""
size="medium"
text="rspec" text="rspec"
variant="default"
> >
<gl-deprecated-dropdown-item-stub <gl-dropdown-item-stub
avatarurl=""
iconcolor=""
iconname=""
iconrightname=""
ischecked="true"
ischeckitem="true"
secondarytext=""
value="rspec" value="rspec"
> >
<div
class="gl-display-flex"
>
<gl-icon-stub
class="gl-absolute"
name="mobile-issue-close"
size="16"
/>
<span
class="gl-display-flex align-items-center ml-4"
>
rspec rspec
</span> </gl-dropdown-item-stub>
</div> <gl-dropdown-item-stub
</gl-deprecated-dropdown-item-stub> avatarurl=""
<gl-deprecated-dropdown-item-stub iconcolor=""
iconname=""
iconrightname=""
ischeckitem="true"
secondarytext=""
value="cypress" value="cypress"
> >
<div
class="gl-display-flex"
>
<!---->
<span
class="gl-display-flex align-items-center ml-4"
>
cypress cypress
</span> </gl-dropdown-item-stub>
</div> <gl-dropdown-item-stub
</gl-deprecated-dropdown-item-stub> avatarurl=""
<gl-deprecated-dropdown-item-stub iconcolor=""
iconname=""
iconrightname=""
ischeckitem="true"
secondarytext=""
value="karma" value="karma"
> >
<div
class="gl-display-flex"
>
<!---->
<span
class="gl-display-flex align-items-center ml-4"
>
karma karma
</span> </gl-dropdown-item-stub>
</div> </gl-dropdown-stub>
</gl-deprecated-dropdown-item-stub>
</gl-deprecated-dropdown-stub>
</div> </div>
<gl-area-chart-stub <gl-area-chart-stub
......
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlAlert, GlIcon, GlDeprecatedDropdown, GlDeprecatedDropdownItem } from '@gitlab/ui'; import { GlAlert, GlDropdown, GlDropdownItem } from '@gitlab/ui';
import { GlAreaChart } from '@gitlab/ui/dist/charts'; import { GlAreaChart } from '@gitlab/ui/dist/charts';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
...@@ -17,7 +17,7 @@ describe('Code Coverage', () => { ...@@ -17,7 +17,7 @@ describe('Code Coverage', () => {
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.find(GlAlert);
const findAreaChart = () => wrapper.find(GlAreaChart); const findAreaChart = () => wrapper.find(GlAreaChart);
const findAllDropdownItems = () => wrapper.findAll(GlDeprecatedDropdownItem); const findAllDropdownItems = () => wrapper.findAll(GlDropdownItem);
const findFirstDropdownItem = () => findAllDropdownItems().at(0); const findFirstDropdownItem = () => findAllDropdownItems().at(0);
const findSecondDropdownItem = () => findAllDropdownItems().at(1); const findSecondDropdownItem = () => findAllDropdownItems().at(1);
...@@ -124,7 +124,7 @@ describe('Code Coverage', () => { ...@@ -124,7 +124,7 @@ describe('Code Coverage', () => {
}); });
it('renders the dropdown with all custom names as options', () => { it('renders the dropdown with all custom names as options', () => {
expect(wrapper.find(GlDeprecatedDropdown).exists()).toBeDefined(); expect(wrapper.find(GlDropdown).exists()).toBeDefined();
expect(findAllDropdownItems()).toHaveLength(codeCoverageMockData.length); expect(findAllDropdownItems()).toHaveLength(codeCoverageMockData.length);
expect(findFirstDropdownItem().text()).toBe(codeCoverageMockData[0].group_name); expect(findFirstDropdownItem().text()).toBe(codeCoverageMockData[0].group_name);
}); });
...@@ -145,16 +145,8 @@ describe('Code Coverage', () => { ...@@ -145,16 +145,8 @@ describe('Code Coverage', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect( expect(findFirstDropdownItem().attributes('ischecked')).toBeFalsy();
findFirstDropdownItem() expect(findSecondDropdownItem().attributes('ischecked')).toBeTruthy();
.find(GlIcon)
.exists(),
).toBe(false);
expect(
findSecondDropdownItem()
.find(GlIcon)
.exists(),
).toBe(true);
}); });
it('updates the graph data when selecting a different option in dropdown', async () => { it('updates the graph data when selecting a different option in dropdown', async () => {
......
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