generated from mlibrary/ruby-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c7a576
commit f96955e
Showing
4 changed files
with
121 additions
and
1 deletion.
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,57 @@ | ||
module Search | ||
module Presenters | ||
class SearchOptions | ||
SEARCH_OPTIONS = YAML.load_file(File.join(S.config_path, "search_options.yaml")) | ||
|
||
def initialize(datastore) | ||
# selects options | ||
end | ||
|
||
def datastore_options | ||
# filtered options | ||
end | ||
|
||
def show_optgroups? | ||
# check if more than one group | ||
end | ||
|
||
def default_option | ||
# get first option | ||
end | ||
|
||
def selected_option | ||
# select option on load | ||
end | ||
|
||
def search_only | ||
# grab only `search` group options (used in advanced search) | ||
end | ||
end | ||
|
||
class SearchOption | ||
def initialize | ||
# | ||
end | ||
|
||
def value | ||
# | ||
end | ||
|
||
def tip | ||
# | ||
end | ||
|
||
def tip_label | ||
# | ||
end | ||
|
||
def text | ||
# | ||
end | ||
|
||
def optgroup | ||
# | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# RSpec.describe Search::Presenters::SearchOptions do | ||
# context "#search_options" do | ||
# it "lists search options in the config file" do | ||
# expect(described_class.new.search_options).to include("...") | ||
# end | ||
# end | ||
|
||
# context "#datastore_search_options" do | ||
# it "lists search options specific to the datastore" do | ||
# expect(described_class.new.datastore_search_options).to include("...") | ||
# end | ||
# it "defaults to the first datastore if datastore is nil" do | ||
# expect(described_class.new.datastore_search_options).to include("...") | ||
# end | ||
# end | ||
|
||
# context "#datastore_search_tips" do | ||
# it "lists search tips specific to the datastore search options" do | ||
# expect(described_class.new.datastore_search_options).to include("...") | ||
# end | ||
# end | ||
|
||
# context "#show_optgroups?" do | ||
# it "checks if there is more than one group of search options" do | ||
# expect(described_class.new.datastore_search_options).to include("...") | ||
# end | ||
# end | ||
|
||
# context "#default_option" do | ||
# it "gives the first search option specific to the datastore" do | ||
# expect(described_class.new.datastore_search_options).to include("...") | ||
# end | ||
# end | ||
|
||
# context "#queried_option" do | ||
# it "lists search options specific to the datastore" do | ||
# expect(described_class.new.datastore_search_options).to include("...") | ||
# end | ||
# it "defaults to the first option if queried option does not exist" do | ||
# expect(described_class.new.datastore_search_options).to include("...") | ||
# end | ||
# it "defaults to the first option if the query contains operators" do | ||
# expect(described_class.new.datastore_search_options).to include("...") | ||
# end | ||
# end | ||
# end | ||
|
||
RSpec.describe Search::Presenters::SearchOption do | ||
context "#value" do | ||
it "has a value" do | ||
search_option = { | ||
"id" => "keyword_contains", | ||
"value" => "keyword", | ||
"text" => "Keyword (contains)", | ||
"tip" => "Enter one or more keywords to search broadly (e.g., Black Women Scientists). Use quotes to search for a specific phrase (e.g., \"systems of oppression\"). See tips about <a href=\"https://guides.lib.umich.edu/c.php?g=914690&p=6590011?utm_source=library-search\" class=\"open-in-new\" target=\"_blank\" rel=\"noopener noreferrer\" aria-label=\"Basic Keyword Searching - opens in new window\">Basic Keyword Searching</a>.", | ||
"group" => "search" | ||
} | ||
expect(described_class.new(search_option).value).to eq(search_option["value"]) | ||
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