Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/admin/action_pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,6 @@ def filter_action_pages
pages = pages.search(filter_params[:q]) if filter_params[:q].present?
filters = filter_params[:action_filters].to_h || {}
filters[:date_range] = filter_params[:date_range]
ActionPageFilters.run(relation: pages, **filters.transform_keys(&:to_sym))
ActionPageFilters.run(relation: pages, **filters.deep_symbolize_keys.to_h)
end
end
2 changes: 1 addition & 1 deletion spec/support/javascript_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ def fill_in_editor(locator, with:)

def fill_in_select2(locator, with:)
find(locator).sibling(".select2-container").click
find("li.select2-results__option[role=treeitem]", text: with).click
find("li.select2-results__option[role=option]", text: with).click
end
end
17 changes: 17 additions & 0 deletions spec/system/admin/action_index_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require "rails_helper"

RSpec.describe "Admin action page index", type: :system, js: true do
before { warden_sign_in(FactoryBot.create(:admin_user)) }

it "can filter actions" do
basic = FactoryBot.create(:action_page, title: "Filtered out")
email_action = FactoryBot.create(:action_page, enable_email: true)

visit admin_action_pages_path
fill_in_select2("#action_filters_type", with: "email")
click_on "Search"

expect(page).to have_content(email_action.title)
expect(page).not_to have_content(basic.title)
end
end