Commit 0b6a3748 authored by Taurie Davis's avatar Taurie Davis Committed by Peter Hegman

Update icon prop for requirements badge

parent 5637d05d
<script>
import { GlBadge, GlIcon, GlTooltip } from '@gitlab/ui';
import { GlBadge, GlTooltip } from '@gitlab/ui';
import { __ } from '~/locale';
import timeagoMixin from '~/vue_shared/mixins/timeago';
......@@ -8,7 +8,6 @@ import { TestReportStatus } from '../constants';
export default {
components: {
GlBadge,
GlIcon,
GlTooltip,
},
mixins: [timeagoMixin],
......@@ -58,8 +57,7 @@ export default {
<template>
<component :is="elementType" class="requirement-status-badge">
<gl-badge ref="testReportBadge" :variant="testReportBadge.variant">
<gl-icon :name="testReportBadge.icon" class="mr-1" />
<gl-badge ref="testReportBadge" :variant="testReportBadge.variant" :icon="testReportBadge.icon">
{{ testReportBadge.text }}
</gl-badge>
<gl-tooltip
......
import { GlBadge, GlIcon, GlTooltip } from '@gitlab/ui';
import { GlBadge, GlTooltip } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import { nextTick } from 'vue';
......@@ -94,9 +94,8 @@ describe('RequirementStatusBadge', () => {
expect(badgeEl.exists()).toBe(true);
expect(badgeEl.props('variant')).toBe(badgeProps.variant);
expect(badgeEl.props('icon')).toBe(badgeProps.icon);
expect(badgeEl.text()).toBe(badgeProps.text);
expect(badgeEl.findComponent(GlIcon).exists()).toBe(true);
expect(badgeEl.findComponent(GlIcon).props('name')).toBe(badgeProps.icon);
});
it('renders GlTooltip component', () => {
......
import { GlPagination, GlIcon } from '@gitlab/ui';
import { GlPagination, GlBadge } from '@gitlab/ui';
import { createLocalVue, shallowMount } from '@vue/test-utils';
import { defaultDataIdFromObject } from 'apollo-cache-inmemory';
import VueApollo from 'vue-apollo';
......@@ -131,7 +131,7 @@ const createComponentWithApollo = ({ props = {}, requestHandlers = [] } = {}) =>
stubs: {
RequirementItem,
RequirementStatusBadge,
GlIcon,
GlBadge,
},
}),
);
......@@ -142,7 +142,7 @@ describe('RequirementsRoot', () => {
let trackingSpy;
const findRequirementEditForm = () => wrapper.findByTestId('edit-form');
const findFailedStatusIcon = () => wrapper.findByTestId('status_failed-icon');
const findBadge = () => wrapper.findComponent(GlBadge);
beforeEach(() => {
wrapper = createComponent();
......@@ -1106,12 +1106,13 @@ describe('RequirementsRoot', () => {
});
it('renders a failed badge after the update', async () => {
expect(findFailedStatusIcon().exists()).toBe(false);
await nextTick();
expect(findBadge().props('icon')).toBe('status_success');
editRequirementToFailed();
await waitForPromises();
expect(findFailedStatusIcon().exists()).toBe(true);
expect(findBadge().props('icon')).toBe('status_failed');
});
});
......
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