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 {
default: () => [],
},
},
computed: {
validIssueWeight() {
return this.issue && this.issue.weight >= 0;
},
},
mounted() {
if (this.canReorder) {
this.sortable = Sortable.create(
......@@ -146,7 +141,7 @@ export default {
class="qa-related-issuable-item"
@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
:weight="issue.weight"
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 {
issuable1,
......@@ -20,7 +22,7 @@ describe('RelatedIssuesList', () => {
const heading = 'Related to';
beforeEach(() => {
wrapper = mount(RelatedIssuesList, {
wrapper = shallowMount(RelatedIssuesList, {
propsData: {
pathIdSeparator: PathIdSeparator.Issue,
issuableType: 'issue',
......@@ -40,7 +42,7 @@ describe('RelatedIssuesList', () => {
describe('with isFetching=true', () => {
beforeEach(() => {
wrapper = mount(RelatedIssuesList, {
wrapper = shallowMount(RelatedIssuesList, {
propsData: {
pathIdSeparator: PathIdSeparator.Issue,
isFetching: true,
......@@ -56,7 +58,7 @@ describe('RelatedIssuesList', () => {
describe('methods', () => {
beforeEach(() => {
wrapper = mount(RelatedIssuesList, {
wrapper = shallowMount(RelatedIssuesList, {
propsData: {
pathIdSeparator: PathIdSeparator.Issue,
relatedIssues: [issuable1, issuable2, issuable3, issuable4, issuable5],
......@@ -104,7 +106,7 @@ describe('RelatedIssuesList', () => {
describe('issuableOrderingId returns correct issuable order id when', () => {
it('issuableType is epic', () => {
wrapper = mount(RelatedIssuesList, {
wrapper = shallowMount(RelatedIssuesList, {
propsData: {
pathIdSeparator: PathIdSeparator.Issue,
issuableType: 'issue',
......@@ -115,7 +117,7 @@ describe('RelatedIssuesList', () => {
});
it('issuableType is issue', () => {
wrapper = mount(RelatedIssuesList, {
wrapper = shallowMount(RelatedIssuesList, {
propsData: {
pathIdSeparator: PathIdSeparator.Issue,
issuableType: 'epic',
......@@ -134,7 +136,7 @@ describe('RelatedIssuesList', () => {
});
it('issuableType is epic', () => {
wrapper = mount(RelatedIssuesList, {
wrapper = shallowMount(RelatedIssuesList, {
propsData: {
pathIdSeparator: PathIdSeparator.Issue,
issuableType: 'epic',
......@@ -150,7 +152,7 @@ describe('RelatedIssuesList', () => {
});
it('issuableType is issue', () => {
wrapper = mount(RelatedIssuesList, {
wrapper = shallowMount(RelatedIssuesList, {
propsData: {
pathIdSeparator: PathIdSeparator.Issue,
issuableType: 'issue',
......@@ -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 = {
path: '/foo/bar/issues/123',
state: 'opened',
linkType: 'relates_to',
dueDate: '2010-11-22',
weight: 5,
};
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