Skip to content

Commit

Permalink
Remove facets helper (#3389)
Browse files Browse the repository at this point in the history
* Remove facets helper

Update selectors in tests accordingly.
Fully override the upstream FacetItemComponent

* Remove our custom tooltip from facet close button
  • Loading branch information
sandbergja committed Feb 27, 2023
1 parent fb7cd86 commit 67b9dc9
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 123 deletions.
8 changes: 0 additions & 8 deletions app/assets/javascripts/orangelight.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ $(document).ready(function() {
}
);

//tooltip for facet remove button
$(".facet-values").tooltip({
selector: "[data-toggle='tooltip']",
placement: "right",
container: "body",
trigger: "hover"
});

$('.chosen-select').chosen({
allow_single_deselect: true,
no_results_text: 'No results matched'
Expand Down
20 changes: 0 additions & 20 deletions app/components/facet_item_component.rb

This file was deleted.

62 changes: 0 additions & 62 deletions app/helpers/facets_helper.rb

This file was deleted.

14 changes: 0 additions & 14 deletions app/views/catalog/_facet_layout.html.erb

This file was deleted.

16 changes: 8 additions & 8 deletions spec/features/facets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@
before do
visit '/catalog'
end
it 'card-header in facet-panel-collapse has link with aria-expanded' do
a_tag_first = find(:xpath, "//*[@id='facet-panel-collapse']/div[1]/div[1]/a")
it 'card-header in facet-panel-collapse has button with aria-expanded' do
a_tag_first = find(:xpath, "//*[@id='facet-panel-collapse']/div[1]/h3/button")
expect(a_tag_first['aria-expanded']).to be_truthy
end
it 'when keydown Enter on <a> tag it toggles the aria-expanded value', js: true do
a_tag_first = find(:xpath, "//*[@id='facet-panel-collapse']/div[1]/div[1]/a")
it 'when keydown Enter on <button> tag it toggles the aria-expanded value', js: true do
a_tag_first = find(:xpath, "//*[@id='facet-panel-collapse']/div[1]/h3/button")
expect(a_tag_first['aria-expanded']).to eq "true"
a_tag_first.native.send_keys(:enter)
expect(a_tag_first['aria-expanded']).to eq "false"
end
it 'when keydown Space on a tag it toggles the aria-expanded value', js: true do
a_tag_first = find(:xpath, "//*[@id='facet-panel-collapse']/div[1]/div[1]/a")
it 'when keydown Space on <button> tag it toggles the aria-expanded value', js: true do
a_tag_first = find(:xpath, "//*[@id='facet-panel-collapse']/div[1]/h3/button")
expect(a_tag_first['aria-expanded']).to eq "true"
a_tag_first.native.send_keys(:space)
expect(a_tag_first['aria-expanded']).to eq "false"
end
it 'when keydown Return on a tag it toggles the aria-expanded value', js: true do
a_tag_first = find(:xpath, "//*[@id='facet-panel-collapse']/div[1]/div[1]/a")
it 'when keydown Return <button> tag it toggles the aria-expanded value', js: true do
a_tag_first = find(:xpath, "//*[@id='facet-panel-collapse']/div[1]/h3/button")
expect(a_tag_first['aria-expanded']).to eq "true"
a_tag_first.native.send_keys(:return)
expect(a_tag_first['aria-expanded']).to eq "false"
Expand Down
10 changes: 0 additions & 10 deletions spec/requests/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -369,16 +369,6 @@
end
end

describe 'facets in search results' do
it 'are configured with a tooltip for removing the book format facet parameter' do
stub_holding_locations
get '/?f%5Bformat%5D%5B%5D=Book&q=&search_field=all_fields'
expect(response.body.include?('<i class="fa fa-times" aria-hidden="true" data-toggle="tooltip" data-original-title="Remove"></i>')).to eq true
get '/?q=&search_field=all_fields'
expect(response.body.include?('<i class="fa fa-times" aria-hidden="true" data-toggle="tooltip" data-original-title="Remove"></i>')).to eq false
end
end

describe 'other versions' do
it 'provides links to other versions of record when they are found' do
get '/catalog/9952918833506421'
Expand Down
2 changes: 1 addition & 1 deletion spec/views/catalog/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
describe 'advanced search' do
it 'inclusive facets display when applied' do
visit '/catalog?f_inclusive%5Bformat%5D%5B%5D=Audio&search_field=advanced'
expect(page).to have_selector('.blacklight-format.facet_limit-active')
expect(page).to have_selector('.blacklight-format.facet-limit-active')
expect(page).to have_selector('.advanced_facet_limit')
end
end
Expand Down

0 comments on commit 67b9dc9

Please sign in to comment.