Commit cd6c3adf authored by Phil Hughes's avatar Phil Hughes

Reverted milestone upcoming default filter

parent f4c9d514
......@@ -7,7 +7,7 @@
this.state.filters = {
author_id: gl.utils.getParameterValues('author_id')[0],
assignee_id: gl.utils.getParameterValues('assignee_id')[0],
milestone_title: gl.utils.getParameterValues('milestone_title')[0] || '#upcoming',
milestone_title: gl.utils.getParameterValues('milestone_title')[0],
label_name: gl.utils.getParameterValues('label_name[]')
};
},
......
......@@ -49,16 +49,12 @@ module IssuablesHelper
end
end
def milestone_dropdown_label(milestone_title, is_boards, default_label = "Milestone")
def milestone_dropdown_label(milestone_title, default_label = "Milestone")
if milestone_title == Milestone::Upcoming.name
milestone_title = Milestone::Upcoming.title
end
if is_boards
boards_default = Milestone::Upcoming.title
end
h(milestone_title.presence || boards_default || default_label)
h(milestone_title.presence || default_label)
end
def issuable_meta(issuable, project, text)
......
......@@ -4,7 +4,7 @@
- content_for :page_specific_javascripts do
= page_specific_javascript_tag('boards/boards_bundle.js')
= page_specific_javascript_tag('boards/test_utils/simulate_drag.js')
= page_specific_javascript_tag('boards/test_utils/simulate_drag.js') if Rails.env.test?
= render "projects/issues/head"
......
- is_boards = controller.controller_name == 'boards'
- if params[:milestone_title].present?
= hidden_field_tag(:milestone_title, params[:milestone_title])
- elsif is_boards
= hidden_field_tag(:milestone_title, Milestone::Upcoming.name)
= dropdown_tag(milestone_dropdown_label(params[:milestone_title], is_boards), options: { title: "Filter by milestone", toggle_class: 'js-milestone-select js-filter-submit', filter: true, dropdown_class: "dropdown-menu-selectable",
= dropdown_tag(milestone_dropdown_label(params[:milestone_title]), options: { title: "Filter by milestone", toggle_class: 'js-milestone-select js-filter-submit', filter: true, dropdown_class: "dropdown-menu-selectable",
placeholder: "Search milestones", footer_content: @project.present?, data: { show_no: true, show_any: true, show_upcoming: true, field_name: "milestone_title", selected: params[:milestone_title], project_id: @project.try(:id), milestones: milestones_filter_dropdown_path, default_label: "Milestone" } }) do
- if @project
%ul.dropdown-footer-list
......
......@@ -44,7 +44,6 @@ describe 'Issue Boards', feature: true, js: true do
end
context 'with lists' do
let!(:milestone_upcoming) { create(:milestone, project: project, due_date: Date.tomorrow) }
let(:milestone) { create(:milestone, project: project) }
let(:planning) { create(:label, project: project, name: 'Planning') }
......@@ -55,16 +54,16 @@ describe 'Issue Boards', feature: true, js: true do
let!(:list1) { create(:list, board: project.board, label: planning, position: 0) }
let!(:list2) { create(:list, board: project.board, label: development, position: 1) }
let!(:confidential_issue) { create(:issue, :confidential, project: project, author: user, milestone: milestone_upcoming) }
let!(:issue1) { create(:issue, project: project, assignee: user, milestone: milestone_upcoming) }
let!(:issue2) { create(:issue, project: project, author: user2, milestone: milestone_upcoming) }
let!(:issue3) { create(:issue, project: project, milestone: milestone_upcoming) }
let!(:issue4) { create(:issue, project: project, milestone: milestone_upcoming) }
let!(:confidential_issue) { create(:issue, :confidential, project: project, author: user) }
let!(:issue1) { create(:issue, project: project, assignee: user) }
let!(:issue2) { create(:issue, project: project, author: user2) }
let!(:issue3) { create(:issue, project: project) }
let!(:issue4) { create(:issue, project: project) }
let!(:issue5) { create(:labeled_issue, project: project, labels: [planning], milestone: milestone) }
let!(:issue6) { create(:labeled_issue, project: project, labels: [planning, development], milestone: milestone_upcoming) }
let!(:issue7) { create(:labeled_issue, project: project, labels: [development], milestone: milestone_upcoming) }
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!(:issue9) { create(:labeled_issue, project: project, labels: [testing, bug], milestone: milestone_upcoming) }
let!(:issue9) { create(:labeled_issue, project: project, labels: [testing, bug]) }
before do
visit namespace_project_board_path(project.namespace, project)
......@@ -78,8 +77,8 @@ describe 'Issue Boards', feature: true, js: true do
it 'shows issues in lists' do
page.within(all('.board')[1]) do
expect(page.find('.board-header')).to have_content('1')
expect(page).to have_selector('.card', count: 1)
expect(page.find('.board-header')).to have_content('2')
expect(page).to have_selector('.card', count: 2)
end
page.within(all('.board')[2]) do
......@@ -103,7 +102,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'infinite scrolls list' do
50.times do
create(:issue, project: project, milestone: milestone_upcoming)
create(:issue, project: project)
end
visit namespace_project_board_path(project.namespace, project)
......@@ -157,8 +156,8 @@ describe 'Issue Boards', feature: true, js: true do
end
page.within(all('.board')[1]) do
expect(page.find('.board-header')).to have_content('2')
expect(page).to have_selector('.card', count: 2)
expect(page.find('.board-header')).to have_content('3')
expect(page).to have_selector('.card', count: 3)
end
end
end
......@@ -179,7 +178,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'removes all of the same issue to done' do
drag_to(list_from_index: 1, list_to_index: 3)
expect(all('.board')[1]).to have_selector('.card', count: 0)
expect(all('.board')[1]).to have_selector('.card', count: 1)
expect(all('.board')[2]).to have_selector('.card', count: 1)
expect(all('.board').last).to have_content(issue6.title)
expect(all('.board').last).not_to have_content(planning.title)
......@@ -195,10 +194,10 @@ describe 'Issue Boards', feature: true, js: true do
end
it 'moves between lists' do
drag_to(list_from_index: 1, list_to_index: 2)
drag_to(list_from_index: 1, card_index: 1, list_to_index: 2)
expect(all('.board')[1]).to have_selector('.card', count: 0)
expect(all('.board')[2]).to have_selector('.card', count: 2)
expect(all('.board')[1]).to have_selector('.card', count: 1)
expect(all('.board')[2]).to have_selector('.card', count: 3)
expect(all('.board')[2]).to have_content(issue6.title)
expect(all('.board')[2].all('.card').last).not_to have_content(development.title)
end
......@@ -206,7 +205,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'moves between lists' do
drag_to(list_from_index: 2, list_to_index: 1)
expect(all('.board')[1]).to have_selector('.card', count: 2)
expect(all('.board')[1]).to have_selector('.card', count: 3)
expect(all('.board')[2]).to have_selector('.card', count: 1)
expect(all('.board')[1]).to have_content(issue7.title)
expect(all('.board')[1].all('.card').first).not_to have_content(planning.title)
......@@ -215,7 +214,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'moves from done' do
drag_to(list_from_index: 3, list_to_index: 1)
expect(all('.board')[1]).to have_selector('.card', count: 2)
expect(all('.board')[1]).to have_selector('.card', count: 3)
expect(all('.board')[1]).to have_content(issue8.title)
end
......@@ -315,7 +314,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by milestone' do
page.within '.issues-filters' do
click_button('Upcoming')
click_button('Milestone')
page.within '.milestone-filter' do
click_link(milestone.title)
......@@ -358,7 +357,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'infinite scrolls list with label filter' do
50.times do
create(:labeled_issue, project: project, labels: [testing], milestone: milestone_upcoming)
create(:labeled_issue, project: project, labels: [testing])
end
page.within '.issues-filters' do
......
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