Commit 3c1ca0e1 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '13321-show-issue-weight-when-zero' into 'master'

Show weight of an issue even when zero

See merge request gitlab-org/gitlab!17329
parents c93bc628 6c9fb393
...@@ -104,6 +104,13 @@ export default { ...@@ -104,6 +104,13 @@ export default {
helpLink() { helpLink() {
return boardsStore.scopedLabels.helpLink; return boardsStore.scopedLabels.helpLink;
}, },
validIssueWeight() {
if (_.isNumber(this.issue.weight)) {
return this.issue.weight >= 0;
}
return false;
},
}, },
methods: { methods: {
isIndexLessThanlimit(index) { isIndexLessThanlimit(index) {
...@@ -212,7 +219,7 @@ export default { ...@@ -212,7 +219,7 @@ export default {
<issue-due-date v-if="issue.dueDate" :date="issue.dueDate" /> <issue-due-date v-if="issue.dueDate" :date="issue.dueDate" />
<issue-time-estimate v-if="issue.timeEstimate" :estimate="issue.timeEstimate" /> <issue-time-estimate v-if="issue.timeEstimate" :estimate="issue.timeEstimate" />
<issue-card-weight <issue-card-weight
v-if="issue.weight" v-if="validIssueWeight"
:weight="issue.weight" :weight="issue.weight"
@click="filterByWeight(issue.weight)" @click="filterByWeight(issue.weight)"
/> />
......
---
title: Show issue weight when weight is 0
merge_request: 17329
author: briankabiro
type: fixed
...@@ -111,6 +111,13 @@ export default { ...@@ -111,6 +111,13 @@ export default {
qaClass() { qaClass() {
return issuableQaClassMap[this.issuableType]; return issuableQaClassMap[this.issuableType];
}, },
validIssueWeight() {
if (this.issue) {
return this.issue.weight >= 0;
}
return false;
},
}, },
mounted() { mounted() {
if (this.canReorder) { if (this.canReorder) {
...@@ -259,7 +266,7 @@ export default { ...@@ -259,7 +266,7 @@ export default {
class="qa-related-issuable-item" class="qa-related-issuable-item"
@relatedIssueRemoveRequest="$emit('relatedIssueRemoveRequest', $event)" @relatedIssueRemoveRequest="$emit('relatedIssueRemoveRequest', $event)"
> >
<span v-if="issue.weight" slot="weight" class="order-md-1"> <span v-if="validIssueWeight" 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"
......
...@@ -42,6 +42,7 @@ describe('Issue card component', () => { ...@@ -42,6 +42,7 @@ describe('Issue card component', () => {
assignees: [], assignees: [],
reference_path: '#1', reference_path: '#1',
real_path: '/test/1', real_path: '/test/1',
weight: 1,
}); });
component = new Vue({ component = new Vue({
...@@ -287,8 +288,17 @@ describe('Issue card component', () => { ...@@ -287,8 +288,17 @@ describe('Issue card component', () => {
}); });
describe('weights', () => { describe('weights', () => {
it('not shows weight component', () => { it('shows weight component is greater than 0', () => {
expect(component.$el.querySelector('.board-card-weight')).toBeNull(); expect(component.$el.querySelector('.board-card-weight')).not.toBeNull();
});
it('shows weight component when weight is 0', done => {
component.issue.weight = 0;
Vue.nextTick(() => {
expect(component.$el.querySelector('.board-card-weight')).not.toBeNull();
done();
});
}); });
}); });
}); });
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