summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-03-14 13:49:53 +0000
committerPhil Hughes <me@iamphill.com>2016-03-14 13:49:53 +0000
commit35aca2d5fdd8d59e2e8ed4e6ce28838ea5bc7f86 (patch)
treefcd3931bc8bce07ba59974806388c5255ec63973
parent37ba5a12b515172b76d28e112ab9899823163717 (diff)
downloadgitlab-ce-issue-filter-tests.tar.gz
Fixed tests for MR & issue filtersissue-filter-tests
-rw-r--r--app/assets/javascripts/gl_dropdown.js.coffee4
-rw-r--r--app/views/shared/issuable/_filter.html.haml2
-rw-r--r--features/steps/dashboard/issues.rb8
-rw-r--r--features/steps/dashboard/merge_requests.rb20
4 files changed, 14 insertions, 20 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js.coffee b/app/assets/javascripts/gl_dropdown.js.coffee
index 8e1449bc59c..b94de4c7b5e 100644
--- a/app/assets/javascripts/gl_dropdown.js.coffee
+++ b/app/assets/javascripts/gl_dropdown.js.coffee
@@ -238,13 +238,15 @@ class GitLabDropdown
selectedObject = @renderedData[selectedIndex]
value = if @options.id then @options.id(selectedObject, el) else selectedObject.id
+ if !value?
+ field.remove()
+
if @options.multiSelect
oldValue = field.val()
if oldValue
value = "#{oldValue},#{value}"
else
@dropdown.find(ACTIVE_CLASS).removeClass ACTIVE_CLASS
- field.remove()
# Toggle active class for the tick mark
el.toggleClass "is-active"
diff --git a/app/views/shared/issuable/_filter.html.haml b/app/views/shared/issuable/_filter.html.haml
index e62d80aeb2c..4df96a06dbe 100644
--- a/app/views/shared/issuable/_filter.html.haml
+++ b/app/views/shared/issuable/_filter.html.haml
@@ -15,7 +15,7 @@
.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 js-assignee-search", title: "Filter by assignee", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable",
+ = dropdown_tag("Assignee", options: { toggle_class: "js-user-search js-filter-submit js-assignee-search", title: "Filter by assignee", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee",
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
diff --git a/features/steps/dashboard/issues.rb b/features/steps/dashboard/issues.rb
index 3072c790a4a..f4a56865532 100644
--- a/features/steps/dashboard/issues.rb
+++ b/features/steps/dashboard/issues.rb
@@ -36,11 +36,9 @@ class Spinach::Features::DashboardIssues < Spinach::FeatureSteps
end
step 'I click "Authored by me" link' do
- 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
+ find("#assignee_id").set("")
+ find(".js-author-search", match: :first).click
+ find(".dropdown-menu-author li a", match: :first, text: current_user.to_reference).click
end
step 'I click "All" link' do
diff --git a/features/steps/dashboard/merge_requests.rb b/features/steps/dashboard/merge_requests.rb
index 7fc0e444e86..a2adc87f8ef 100644
--- a/features/steps/dashboard/merge_requests.rb
+++ b/features/steps/dashboard/merge_requests.rb
@@ -40,22 +40,16 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps
end
step 'I click "Authored by me" link' do
- 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
+ find("#assignee_id").set("")
+ find(".js-author-search", match: :first).click
+ find(".dropdown-menu-author li a", match: :first, text: current_user.to_reference).click
end
step 'I click "All" link' do
- 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
+ find(".js-author-search").click
+ find(".dropdown-menu-author li a", match: :first).click
+ find(".js-assignee-search").click
+ find(".dropdown-menu-assignee li a", match: :first).click
end
def should_see(merge_request)