Commit 8d7e0f0b authored by Phil Hughes's avatar Phil Hughes

Fixed failing tests

parent a9ea06ed
......@@ -25,12 +25,12 @@ class @MilestoneSelect
if showNo
data.unshift(
id: "0"
title: 'No milestone'
title: 'No Milestone'
)
if showAny
data.unshift(
title: 'Any milestone'
title: 'Any Milestone'
)
if data.length > 2
......
.filter-item {
margin-right: 6px;
vertical-align: top;
}
@media (min-width: 800px) {
......
......@@ -9,20 +9,21 @@
.filter-item.inline
- if params[:author_id]
= hidden_field_tag(:author_id, params[:author_id])
= dropdown_tag("Author", options: { toggle_class: "js-user-search js-filter-submit", title: "Filter by author", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable",
placeholder: "Search authors", data: { any_user: "Any Author", first_user: true, current_user: true, project_id: @project.id, selected: params[:author_id], field_name: "author_id" } })
= dropdown_tag("Author", options: { toggle_class: "js-user-search js-filter-submit js-author-search", title: "Filter by author", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-author",
placeholder: "Search authors", data: { any_user: "Any Author", first_user: (current_user.username if current_user), current_user: true, project_id: (@project.id if @project), selected: params[:author_id], field_name: "author_id" } })
.filter-item.inline
- if params[:assignee_id]
= hidden_field_tag(:assignee_id, params[:assignee_id])
= dropdown_tag("Assignee", options: { toggle_class: "js-user-search js-filter-submit", title: "Filter by assignee", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable",
placeholder: "Search assignee", data: { any_user: "Any Author", first_user: true, null_user: true, current_user: true, project_id: @project.id, selected: params[:assignee_id], field_name: "assignee_id" } })
placeholder: "Search assignee", data: { any_user: "Any Author", first_user: (current_user.username if current_user), null_user: true, current_user: true, project_id: (@project.id if @project), selected: params[:assignee_id], field_name: "assignee_id" } })
.filter-item.inline.milestone-filter
- if params[:milestone_title]
= hidden_field_tag(:milestone_title, params[:milestone_title])
= dropdown_tag("Milestone", 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: true, data: { show_no: true, show_any: true, field_name: "milestone_title", selected: params[:milestone_title], project_id: @project.id, milestones: namespace_project_milestones_path(@project.namespace, @project, :js) } }) do
placeholder: "Search milestones", footer_content: true, data: { show_no: true, show_any: true, field_name: "milestone_title", selected: params[:milestone_title], project_id: (@project.id if @project), milestones: (namespace_project_milestones_path(@project.namespace, @project, :js) if @project) } }) do
- if @project
%ul.dropdown-footer-list
- if can? current_user, :admin_milestone, @project
%li
......@@ -39,7 +40,7 @@
- if params[:label_name]
= hidden_field_tag(:label_name, params[:label_name])
.dropdown
%button.dropdown-menu-toggle.js-label-select.js-filter-submit{type: "button", data: {toggle: "dropdown", field_name: "label_name", show_no: "true", show_any: "true", selected: params[:label_name], project_id: @project.id, labels: namespace_project_labels_path(@project.namespace, @project, :js)}}
%button.dropdown-menu-toggle.js-label-select.js-filter-submit{type: "button", data: {toggle: "dropdown", field_name: "label_name", show_no: "true", show_any: "true", selected: params[:label_name], project_id: (@project.id if @project), labels: (namespace_project_labels_path(@project.namespace, @project, :js) if @project)}}
%span.dropdown-toggle-text
Label
= icon('chevron-down')
......@@ -48,6 +49,7 @@
= dropdown_title("Filter by label")
= dropdown_filter("Search labels")
= dropdown_content
- if @project
= dropdown_footer do
%ul.dropdown-footer-list
- if can? current_user, :admin_label, @project
......@@ -92,7 +94,7 @@
%a{href: "#", data: {id: "close"}} Closed
.filter-item.inline
= dropdown_tag("Assignee", options: { toggle_class: "js-user-search", title: "Assign to", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable",
placeholder: "Search authors", data: { first_user: true, current_user: true, project_id: @project.id, field_name: "update[assignee_id]" } })
placeholder: "Search authors", data: { first_user: (current_user.username if current_user), current_user: true, project_id: @project.id, field_name: "update[assignee_id]" } })
.filter-item.inline
= dropdown_tag("Milestone", options: { title: "Assign milestone", toggle_class: 'js-milestone-select', filter: true, dropdown_class: "dropdown-menu-selectable",
placeholder: "Search milestones", data: { show_no: true, field_name: "update[milestone_id]", project_id: @project.id, milestones: namespace_project_milestones_path(@project.namespace, @project, :js), use_id: true } })
......
......@@ -36,13 +36,22 @@ class Spinach::Features::DashboardIssues < Spinach::FeatureSteps
end
step 'I click "Authored by me" link' do
select2(current_user.id, from: "#author_id")
select2(nil, from: "#assignee_id")
execute_script('$("#assignee_id").val("")')
execute_script('$(".js-user-search").first().click()')
sleep 1
execute_script("$('.dropdown-content li:contains(\"#{current_user.to_reference}\") a').click()")
sleep 1
end
step 'I click "All" link' do
select2(nil, from: "#author_id")
select2(nil, from: "#assignee_id")
execute_script('$(".js-user-search").first().click()')
sleep 1
execute_script('$(".js-user-search").first().parent().find("li a").first().click()')
sleep 1
execute_script('$(".js-user-search").eq(1).click()')
sleep 1
execute_script('$(".js-user-search").eq(1).parent().find("li a").first().click()')
sleep 1
end
def should_see(issue)
......
......@@ -40,13 +40,22 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps
end
step 'I click "Authored by me" link' do
select2(current_user.id, from: "#author_id")
select2(nil, from: "#assignee_id")
execute_script('$("#assignee_id").val("")')
execute_script('$(".js-user-search").first().click()')
sleep 0.5
execute_script("$('.dropdown-content li:contains(\"#{current_user.to_reference}\") a').click()")
sleep 2
end
step 'I click "All" link' do
select2(nil, from: "#author_id")
select2(nil, from: "#assignee_id")
execute_script('$(".js-user-search").first().click()')
sleep 0.5
execute_script('$(".js-user-search").first().parent().find("li a").first().click()')
sleep 2
execute_script('$(".js-user-search").eq(1).click()')
sleep 0.5
execute_script('$(".js-user-search").eq(1).parent().find("li a").first().click()')
sleep 2
end
def should_see(merge_request)
......
......@@ -29,7 +29,10 @@ class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps
end
step 'I click link "bug"' do
select2('bug', from: "#label_name")
page.find('.js-label-select').click
sleep 0.5
execute_script("$('.dropdown-menu-labels li:contains(\"bug\") a').click()")
sleep 2
end
step 'I click link "feature"' do
......
......@@ -27,7 +27,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
step 'I click link "Closed"' do
click_link "Closed"
find('.issues-state-filters a', text: "Closed").click
end
step 'I click button "Unsubscribe"' do
......@@ -63,14 +63,15 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
step 'I click "author" dropdown' do
first('#s2id_author_id').click
page.find('.js-author-search').click
sleep 1
end
step 'I see current user as the first user' do
expect(page).to have_selector('.user-result', visible: true, count: 3)
users = page.all('.user-name')
expect(page).to have_selector('.dropdown-content', visible: true)
users = page.all('.dropdown-menu-author .dropdown-content li a')
expect(users[0].text).to eq 'Any Author'
expect(users[1].text).to eq current_user.name
expect(users[1].text).to eq "#{current_user.name} #{current_user.to_reference}"
end
step 'I submit new issue "500 error on profile"' do
......
......@@ -31,6 +31,9 @@ feature 'Issue filtering by Milestone', feature: true do
end
def filter_by_milestone(title)
select2(title, from: '#milestone_title')
find(".js-milestone-select").click
sleep 1
find(".milestone-filter a", text: title).click
sleep 1
end
end
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