Commit 06ad62cd authored by Coung Ngo's avatar Coung Ngo

Improve Health Status code

Make changes as a result of reviewer comments
parent fe2ef898
...@@ -145,20 +145,20 @@ export default { ...@@ -145,20 +145,20 @@ export default {
</div> </div>
<gl-loading-icon v-if="isFetching" :inline="true" /> <gl-loading-icon v-if="isFetching" :inline="true" />
<p v-else class="value m-0" :class="{ 'no-value': !status }"> <p v-else class="value d-flex align-items-center m-0" :class="{ 'no-value': !status }">
<gl-icon <gl-icon
v-if="status" v-if="status"
name="severity-low" name="severity-low"
:size="14" :size="14"
class="align-bottom mr-2" class="align-bottom append-right-10"
:class="statusColor" :class="statusColor"
/> />
{{ statusText }} {{ statusText }}
<template v-if="canRemoveStatus"> <template v-if="canRemoveStatus">
<span class="text-secondary" aria-hidden="true">-</span> <span class="text-secondary mx-1" aria-hidden="true">-</span>
<button class="btn-link text-secondary" @click="removeStatus"> <gl-button variant="link" class="text-secondary" @click="removeStatus">
{{ __('remove status') }} {{ __('remove status') }}
</button> </gl-button>
</template> </template>
</p> </p>
</div> </div>
......
...@@ -59,9 +59,12 @@ describe('SidebarStatus', () => { ...@@ -59,9 +59,12 @@ describe('SidebarStatus', () => {
status: 'onTrack', status: 'onTrack',
}, },
updateStatus(status) { updateStatus(status) {
const newMediator = { ...this }; this.store.status = status;
newMediator.store.status = status; wrapper.setProps({
wrapper.setProps({ mediator: newMediator }); mediator: {
...this,
},
});
return Promise.resolve(); return Promise.resolve();
}, },
}; };
...@@ -77,7 +80,7 @@ describe('SidebarStatus', () => { ...@@ -77,7 +80,7 @@ describe('SidebarStatus', () => {
wrapper.find('button.btn-link').trigger('click'); wrapper.find('button.btn-link').trigger('click');
return Vue.nextTick().then(() => { return Vue.nextTick().then(() => {
expect(getStatusText(wrapper)).toContain('None'); expect(getStatusText(wrapper)).toBe('None');
}); });
}); });
}); });
import { GlFormRadioGroup, GlLoadingIcon, GlTooltip } from '@gitlab/ui'; import { GlButton, GlFormRadioGroup, GlLoadingIcon, GlTooltip } from '@gitlab/ui';
import { mount, shallowMount } from '@vue/test-utils'; import { mount, shallowMount } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import Status from 'ee/sidebar/components/status/status.vue'; import Status from 'ee/sidebar/components/status/status.vue';
...@@ -12,7 +12,7 @@ const getStatusIconCssClasses = wrapper => wrapper.find('[name="severity-low"]') ...@@ -12,7 +12,7 @@ const getStatusIconCssClasses = wrapper => wrapper.find('[name="severity-low"]')
const getEditButton = wrapper => wrapper.find({ ref: 'editButton' }); const getEditButton = wrapper => wrapper.find({ ref: 'editButton' });
const getRemoveStatusButton = wrapper => wrapper.find('.value .btn-link'); const getRemoveStatusButton = wrapper => wrapper.find(GlButton);
const getEditForm = wrapper => wrapper.find('form'); const getEditForm = wrapper => wrapper.find('form');
...@@ -120,7 +120,7 @@ describe('Status', () => { ...@@ -120,7 +120,7 @@ describe('Status', () => {
shallowMountStatus(props); shallowMountStatus(props);
getRemoveStatusButton(wrapper).trigger('click'); getRemoveStatusButton(wrapper).vm.$emit('click');
expect(wrapper.emitted().onStatusChange[0]).toEqual([null]); expect(wrapper.emitted().onStatusChange[0]).toEqual([null]);
}); });
......
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