Commit a4a3900a authored by Coung Ngo's avatar Coung Ngo

Fix weight not showing in related issues

Weights should show in the Linked issues block when it has a non-zero
value
parent 117e2614
...@@ -53,11 +53,6 @@ export default { ...@@ -53,11 +53,6 @@ export default {
default: () => [], default: () => [],
}, },
}, },
computed: {
validIssueWeight() {
return this.issue && this.issue.weight >= 0;
},
},
mounted() { mounted() {
if (this.canReorder) { if (this.canReorder) {
this.sortable = Sortable.create( this.sortable = Sortable.create(
...@@ -146,7 +141,7 @@ export default { ...@@ -146,7 +141,7 @@ export default {
class="qa-related-issuable-item" class="qa-related-issuable-item"
@relatedIssueRemoveRequest="$emit('relatedIssueRemoveRequest', $event)" @relatedIssueRemoveRequest="$emit('relatedIssueRemoveRequest', $event)"
> >
<span v-if="validIssueWeight" slot="weight" class="order-md-1"> <span v-if="issue.weight > 0" slot="weight" class="order-md-1">
<issue-weight <issue-weight
:weight="issue.weight" :weight="issue.weight"
class="item-weight d-flex align-items-center" class="item-weight d-flex align-items-center"
......
---
title: Fix weight not showing in linked issues
merge_request: 25718
author:
type: fixed
import { mount } from '@vue/test-utils'; import { mount, shallowMount } from '@vue/test-utils';
import IssueDueDate from '~/boards/components/issue_due_date.vue';
import IssueWeight from 'ee/boards/components/issue_card_weight.vue';
import RelatedIssuesList from 'ee/related_issues/components/related_issues_list.vue'; import RelatedIssuesList from 'ee/related_issues/components/related_issues_list.vue';
import { import {
issuable1, issuable1,
...@@ -20,7 +22,7 @@ describe('RelatedIssuesList', () => { ...@@ -20,7 +22,7 @@ describe('RelatedIssuesList', () => {
const heading = 'Related to'; const heading = 'Related to';
beforeEach(() => { beforeEach(() => {
wrapper = mount(RelatedIssuesList, { wrapper = shallowMount(RelatedIssuesList, {
propsData: { propsData: {
pathIdSeparator: PathIdSeparator.Issue, pathIdSeparator: PathIdSeparator.Issue,
issuableType: 'issue', issuableType: 'issue',
...@@ -40,7 +42,7 @@ describe('RelatedIssuesList', () => { ...@@ -40,7 +42,7 @@ describe('RelatedIssuesList', () => {
describe('with isFetching=true', () => { describe('with isFetching=true', () => {
beforeEach(() => { beforeEach(() => {
wrapper = mount(RelatedIssuesList, { wrapper = shallowMount(RelatedIssuesList, {
propsData: { propsData: {
pathIdSeparator: PathIdSeparator.Issue, pathIdSeparator: PathIdSeparator.Issue,
isFetching: true, isFetching: true,
...@@ -56,7 +58,7 @@ describe('RelatedIssuesList', () => { ...@@ -56,7 +58,7 @@ describe('RelatedIssuesList', () => {
describe('methods', () => { describe('methods', () => {
beforeEach(() => { beforeEach(() => {
wrapper = mount(RelatedIssuesList, { wrapper = shallowMount(RelatedIssuesList, {
propsData: { propsData: {
pathIdSeparator: PathIdSeparator.Issue, pathIdSeparator: PathIdSeparator.Issue,
relatedIssues: [issuable1, issuable2, issuable3, issuable4, issuable5], relatedIssues: [issuable1, issuable2, issuable3, issuable4, issuable5],
...@@ -104,7 +106,7 @@ describe('RelatedIssuesList', () => { ...@@ -104,7 +106,7 @@ describe('RelatedIssuesList', () => {
describe('issuableOrderingId returns correct issuable order id when', () => { describe('issuableOrderingId returns correct issuable order id when', () => {
it('issuableType is epic', () => { it('issuableType is epic', () => {
wrapper = mount(RelatedIssuesList, { wrapper = shallowMount(RelatedIssuesList, {
propsData: { propsData: {
pathIdSeparator: PathIdSeparator.Issue, pathIdSeparator: PathIdSeparator.Issue,
issuableType: 'issue', issuableType: 'issue',
...@@ -115,7 +117,7 @@ describe('RelatedIssuesList', () => { ...@@ -115,7 +117,7 @@ describe('RelatedIssuesList', () => {
}); });
it('issuableType is issue', () => { it('issuableType is issue', () => {
wrapper = mount(RelatedIssuesList, { wrapper = shallowMount(RelatedIssuesList, {
propsData: { propsData: {
pathIdSeparator: PathIdSeparator.Issue, pathIdSeparator: PathIdSeparator.Issue,
issuableType: 'epic', issuableType: 'epic',
...@@ -134,7 +136,7 @@ describe('RelatedIssuesList', () => { ...@@ -134,7 +136,7 @@ describe('RelatedIssuesList', () => {
}); });
it('issuableType is epic', () => { it('issuableType is epic', () => {
wrapper = mount(RelatedIssuesList, { wrapper = shallowMount(RelatedIssuesList, {
propsData: { propsData: {
pathIdSeparator: PathIdSeparator.Issue, pathIdSeparator: PathIdSeparator.Issue,
issuableType: 'epic', issuableType: 'epic',
...@@ -150,7 +152,7 @@ describe('RelatedIssuesList', () => { ...@@ -150,7 +152,7 @@ describe('RelatedIssuesList', () => {
}); });
it('issuableType is issue', () => { it('issuableType is issue', () => {
wrapper = mount(RelatedIssuesList, { wrapper = shallowMount(RelatedIssuesList, {
propsData: { propsData: {
pathIdSeparator: PathIdSeparator.Issue, pathIdSeparator: PathIdSeparator.Issue,
issuableType: 'issue', issuableType: 'issue',
...@@ -165,4 +167,24 @@ describe('RelatedIssuesList', () => { ...@@ -165,4 +167,24 @@ describe('RelatedIssuesList', () => {
}); });
}); });
}); });
describe('related item contents', () => {
beforeAll(() => {
wrapper = mount(RelatedIssuesList, {
propsData: {
issuableType: 'issue',
pathIdSeparator: PathIdSeparator.Issue,
relatedIssues: [issuable1],
},
});
});
it('shows weight', () => {
expect(wrapper.find(IssueWeight).text()).toBe(issuable1.weight.toString());
});
it('shows due date', () => {
expect(wrapper.find(IssueDueDate).text()).toBe('Nov 22, 2010');
});
});
}); });
...@@ -14,6 +14,8 @@ export const issuable1 = { ...@@ -14,6 +14,8 @@ export const issuable1 = {
path: '/foo/bar/issues/123', path: '/foo/bar/issues/123',
state: 'opened', state: 'opened',
linkType: 'relates_to', linkType: 'relates_to',
dueDate: '2010-11-22',
weight: 5,
}; };
export const issuable2 = { export const issuable2 = {
......
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