Commit 7cae5773 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'winh-show-weight-on-new-board-issue-ce' into 'master'

Show weight on new board issue (CE-backport)

See merge request gitlab-org/gitlab-ce!32746
parents a7f3d980 b896a853
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
import $ from 'jquery'; import $ from 'jquery';
import { GlButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import { getMilestone } from 'ee_else_ce/boards/boards_util'; import { getMilestone } from 'ee_else_ce/boards/boards_util';
import ListIssue from 'ee_else_ce/boards/models/issue';
import eventHub from '../eventhub'; import eventHub from '../eventhub';
import ProjectSelect from './project_select.vue'; import ProjectSelect from './project_select.vue';
import ListIssue from '../models/issue';
import boardsStore from '../stores/boards_store'; import boardsStore from '../stores/boards_store';
export default { export default {
...@@ -54,6 +54,9 @@ export default { ...@@ -54,6 +54,9 @@ export default {
const assignees = this.list.assignee ? [this.list.assignee] : []; const assignees = this.list.assignee ? [this.list.assignee] : [];
const milestone = getMilestone(this.list); const milestone = getMilestone(this.list);
const { weightFeatureAvailable } = boardsStore;
const { weight } = weightFeatureAvailable ? boardsStore.state.currentBoard : {};
const issue = new ListIssue({ const issue = new ListIssue({
title: this.title, title: this.title,
labels, labels,
...@@ -61,6 +64,7 @@ export default { ...@@ -61,6 +64,7 @@ export default {
assignees, assignees,
milestone, milestone,
project_id: this.selectedProject.id, project_id: this.selectedProject.id,
weight,
}); });
eventHub.$emit(`scroll-board-list-${this.list.id}`); eventHub.$emit(`scroll-board-list-${this.list.id}`);
......
...@@ -171,6 +171,32 @@ describe('Issue boards new issue form', () => { ...@@ -171,6 +171,32 @@ describe('Issue boards new issue form', () => {
.then(done) .then(done)
.catch(done.fail); .catch(done.fail);
}); });
it('sets detail weight after submit', done => {
boardsStore.weightFeatureAvailable = true;
vm.title = 'submit issue';
Vue.nextTick()
.then(submitIssue)
.then(() => {
expect(boardsStore.detail.list.weight).toBe(list.weight);
})
.then(done)
.catch(done.fail);
});
it('does not set detail weight after submit', done => {
boardsStore.weightFeatureAvailable = false;
vm.title = 'submit issue';
Vue.nextTick()
.then(submitIssue)
.then(() => {
expect(boardsStore.detail.list.weight).toBe(list.weight);
})
.then(done)
.catch(done.fail);
});
}); });
describe('submit error', () => { describe('submit error', () => {
......
...@@ -12,6 +12,7 @@ export const listObj = { ...@@ -12,6 +12,7 @@ export const listObj = {
position: 0, position: 0,
title: 'Test', title: 'Test',
list_type: 'label', list_type: 'label',
weight: 3,
label: { label: {
id: 5000, id: 5000,
title: 'Testing', title: 'Testing',
...@@ -26,6 +27,7 @@ export const listObjDuplicate = { ...@@ -26,6 +27,7 @@ export const listObjDuplicate = {
position: 1, position: 1,
title: 'Test', title: 'Test',
list_type: 'label', list_type: 'label',
weight: 3,
label: { label: {
id: listObj.label.id, id: listObj.label.id,
title: 'Testing', title: 'Testing',
......
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