Skip to content

Commit

Permalink
Use updated capybara filter_block syntax (#3044)
Browse files Browse the repository at this point in the history
* Use updated capybara filter_block syntax

teamcapybara/capybara#2617 changed
how blocks are evaluated.  Thanks to @maxkadel for finding
this change!

* rubocop -a

* ViewComponent 3 compatibility: don't call i18n methods in a component initializer

This is due to this upstream PR: ViewComponent/view_component#1666
  • Loading branch information
sandbergja authored and cbeer committed Aug 10, 2023
1 parent 4817e1c commit 6d68e6f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= content_tag :section, class: 'pagination', **@html_attr do %>
<%= content_tag :section, class: 'pagination', **html_attr do %>
<%= pagination %>
<% end %>
6 changes: 5 additions & 1 deletion app/components/blacklight/response/pagination_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ class PaginationComponent < Blacklight::Component
# @param [Hash] html html options for the pagination container
def initialize(response:, html: {}, **pagination_args)
@response = response
@html_attr = { aria: { label: t('views.pagination.aria.container_label') } }.merge(html)
@html = html
@pagination_args = pagination_args
end

def html_attr
{ aria: { label: t('views.pagination.aria.container_label') } }.merge(@html)
end

def pagination
helpers.paginate @response, **Blacklight::Engine.config.blacklight.default_pagination_options, **@pagination_args
end
Expand Down
8 changes: 4 additions & 4 deletions lib/railties/blacklight.rake
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace :blacklight do
exit 1
end
rescue => e
puts e.to_s
puts e
exit 1
end

Expand Down Expand Up @@ -71,7 +71,7 @@ namespace :blacklight do
end
rescue => e
errors += 1
puts e.to_s
puts e
end

print " - search_results: "
Expand All @@ -93,7 +93,7 @@ namespace :blacklight do
end
rescue => e
errors += 1
puts e.to_s
puts e
end

print " - fetch: "
Expand All @@ -113,7 +113,7 @@ namespace :blacklight do
end
rescue => e
errors += 1
puts e.to_s
puts e
end

exit 1 if errors > 0
Expand Down
14 changes: 4 additions & 10 deletions spec/presenters/blacklight/show_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ def export_as_weird_dup

MockDocument.use_extension(MockExtension)

def mock_document_app_helper_url *args
solr_document_url(*args)
end

allow(request_context).to receive(:polymorphic_url) do |_, opts|
"url.#{opts[:format]}"
end
Expand All @@ -70,12 +66,10 @@ def mock_document_app_helper_url *args
tmp_value = Capybara.ignore_hidden_elements
Capybara.ignore_hidden_elements = false
document.export_formats.each_pair do |format, _spec|
expect(subject).to have_selector("link[href$='.#{format}']") do |matches|
expect(matches).to have(1).match
tag = matches[0]
expect(tag.attributes["rel"].value).to eq "alternate"
expect(tag.attributes["title"].value).to eq format.to_s
expect(tag.attributes["href"].value).to eq mock_document_app_helper_url(document, format: format)
expect(subject).to have_selector("link[href$='.#{format}']", count: 1) do |tag|
expect(tag["rel"]).to eq "alternate"
expect(tag["title"]).to eq format.to_s
expect(tag["href"]).to eq "url.#{format}"
end
end
Capybara.ignore_hidden_elements = tmp_value
Expand Down

0 comments on commit 6d68e6f

Please sign in to comment.