Fixed bug with creating new list from Backlog or done label

This commit is contained in:
Phil Hughes 2016-08-12 10:39:45 +01:00
parent cd6c3adf3e
commit 19afb1e723
3 changed files with 27 additions and 5 deletions

View file

@ -19,7 +19,7 @@
}, },
new (listObj) { new (listObj) {
const list = this.addList(listObj), const list = this.addList(listObj),
backlogList = this.findList('type', 'backlog'); backlogList = this.findList('type', 'backlog', 'backlog');
list list
.save() .save()
@ -123,9 +123,9 @@
listFrom.removeIssue(issue); listFrom.removeIssue(issue);
} }
}, },
findList (key, val) { findList (key, val, type = 'label') {
return this.state.lists.filter((list) => { return this.state.lists.filter((list) => {
return list[key] === val; return list[key] === val && list['type'] === type;
})[0]; })[0];
}, },
updateFiltersUrl () { updateFiltersUrl () {

View file

@ -50,6 +50,8 @@ describe 'Issue Boards', feature: true, js: true do
let(:development) { create(:label, project: project, name: 'Development') } let(:development) { create(:label, project: project, name: 'Development') }
let(:testing) { create(:label, project: project, name: 'Testing') } let(:testing) { create(:label, project: project, name: 'Testing') }
let(:bug) { create(:label, project: project, name: 'Bug') } let(:bug) { create(:label, project: project, name: 'Bug') }
let!(:backlog) { create(:label, project: project, name: 'Backlog') }
let!(:done) { create(:label, project: project, name: 'Done') }
let!(:list1) { create(:list, board: project.board, label: planning, position: 0) } let!(:list1) { create(:list, board: project.board, label: planning, position: 0) }
let!(:list2) { create(:list, board: project.board, label: development, position: 1) } let!(:list2) { create(:list, board: project.board, label: development, position: 1) }
@ -62,7 +64,7 @@ describe 'Issue Boards', feature: true, js: true do
let!(:issue5) { create(:labeled_issue, project: project, labels: [planning], milestone: milestone) } let!(:issue5) { create(:labeled_issue, project: project, labels: [planning], milestone: milestone) }
let!(:issue6) { create(:labeled_issue, project: project, labels: [planning, development]) } let!(:issue6) { create(:labeled_issue, project: project, labels: [planning, development]) }
let!(:issue7) { create(:labeled_issue, project: project, labels: [development]) } let!(:issue7) { create(:labeled_issue, project: project, labels: [development]) }
let!(:issue8) { create(:closed_issue, project: project, milestone: milestone_upcoming) } let!(:issue8) { create(:closed_issue, project: project) }
let!(:issue9) { create(:labeled_issue, project: project, labels: [testing, bug]) } let!(:issue9) { create(:labeled_issue, project: project, labels: [testing, bug]) }
before do before do
@ -247,6 +249,26 @@ describe 'Issue Boards', feature: true, js: true do
expect(page).to have_selector('.board', count: 5) expect(page).to have_selector('.board', count: 5)
end end
it 'creates new list for Backlog label' do
click_button 'Create new list'
page.within('.dropdown-menu-issues-board-new') do
click_link backlog.title
end
expect(page).to have_selector('.board', count: 5)
end
it 'creates new list for Done label' do
click_button 'Create new list'
page.within('.dropdown-menu-issues-board-new') do
click_link done.title
end
expect(page).to have_selector('.board', count: 5)
end
it 'moves issues from backlog into new list' do it 'moves issues from backlog into new list' do
page.within(first('.board')) do page.within(first('.board')) do
expect(page.find('.board-header')).to have_content('6') expect(page.find('.board-header')).to have_content('6')

View file

@ -104,7 +104,7 @@
it('adds the blank state', () => { it('adds the blank state', () => {
BoardsStore.addBlankState(); BoardsStore.addBlankState();
const list = BoardsStore.findList('type', 'blank'); const list = BoardsStore.findList('type', 'blank', 'blank');
expect(list).toBeDefined(); expect(list).toBeDefined();
}); });