Commit 78b25cfa authored by Rémy Coutable's avatar Rémy Coutable

Merge branch...

Merge branch 'ce-22457-reset-filters-button-should-be-invisible-when-no-filters-are-active-ee' into 'master'

`Reset filters` link should only be visible when filters are active

**EE version of gitlab-org/gitlab-ce!6497.**

## What does this MR do?

> Adds `issuable_filters_present` helper method to check for any filters before rendering the reset link.

## Why was this MR needed?

> `Reset filters` link is always visible.

See merge request !785
parents 24cfede7 f86432a2
......@@ -124,6 +124,10 @@ module IssuablesHelper
end
end
def issuable_filters_present
params[:search] || params[:author_id] || params[:assignee_id] || params[:milestone_title] || params[:label_name] || params[:weight]
end
def issuables_count_for_state(issuable_type, state)
issuables_finder = public_send("#{issuable_type}_finder")
issuables_finder.params[:state] = state
......
......@@ -41,8 +41,9 @@
%a{href: "#", data: { id: weight }, class: ("is-active" if params[:weight] == weight.to_s)}
= weight
- if issuable_filters_present
.filter-item.inline.reset-filters
%a{href: page_filter_path(without: [:assignee_id, :author_id, :milestone_title, :label_name, :search])} Reset filters
%a{href: page_filter_path(without: [:assignee_id, :author_id, :milestone_title, :label_name, :weight, :search])} Reset filters
.pull-right
- if boards_page
......
......@@ -75,6 +75,14 @@ feature 'Issues filter reset button', feature: true, js: true do
end
end
context 'when no filters have been applied' do
it 'the reset link should not be visible' do
visit_issues(project)
expect(page).to have_css('.issue', count: 2)
expect(page).not_to have_css '.reset_filters'
end
end
def reset_filters
find('.reset-filters').click
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