-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3721 from pulibrary/i3703-constraints
i3703: display constraints for new advanced search results
- Loading branch information
Showing
5 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
module Orangelight | ||
class ClausePresenter < Blacklight::ClausePresenter | ||
def label | ||
if user_parameters[:op] == 'must_not' | ||
"NOT #{super}" | ||
else | ||
super | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe Orangelight::ClausePresenter do | ||
subject(:presenter) do | ||
described_class.new('0', params.with_indifferent_access.dig(:clause, '0'), field_config, nil, search_state) | ||
end | ||
|
||
let(:field_config) { Blacklight::Configuration::NullField.new key: 'some_field' } | ||
let(:search_state) { Blacklight::SearchState.new(params.with_indifferent_access, Blacklight::Configuration.new) } | ||
let(:params) { { clause: { '0' => { query: 'some search string', op: 'must_not' } } } } | ||
|
||
describe '#label' do | ||
it 'includes the NOT boolean operator if appropriate' do | ||
expect(subject.label).to eq 'NOT some search string' | ||
end | ||
end | ||
end |