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

View file

@ -50,6 +50,8 @@ describe 'Issue Boards', feature: true, js: true do
let(:development) { create(:label, project: project, name: 'Development') }
let(:testing) { create(:label, project: project, name: 'Testing') }
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!(: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!(:issue6) { create(:labeled_issue, project: project, labels: [planning, 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]) }
before do
@ -247,6 +249,26 @@ describe 'Issue Boards', feature: true, js: true do
expect(page).to have_selector('.board', count: 5)
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
page.within(first('.board')) do
expect(page.find('.board-header')).to have_content('6')

View file

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