blacklight 4.3.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +0 -6
- data/Gemfile +5 -0
- data/README.md +1 -1
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/autofocus.js +16 -0
- data/app/assets/javascripts/blacklight/blacklight.js +1 -0
- data/app/assets/javascripts/blacklight/bookmark_toggle.js +2 -5
- data/app/assets/javascripts/blacklight/checkbox_submit.js +3 -6
- data/app/assets/javascripts/blacklight/core.js +24 -1
- data/app/assets/javascripts/blacklight/css_dropdowns.js +2 -2
- data/app/assets/javascripts/blacklight/facet_expand_contract.js +4 -3
- data/app/assets/javascripts/blacklight/lightbox_dialog.js +7 -1
- data/app/assets/javascripts/blacklight/search_context.js +1 -1
- data/app/assets/javascripts/blacklight/select_submit.js +1 -1
- data/app/assets/javascripts/blacklight/zebra_stripe.js +1 -1
- data/app/assets/stylesheets/blacklight/_blacklight_base.css.scss +1 -0
- data/app/assets/stylesheets/blacklight/_catalog.css.scss +5 -0
- data/app/assets/stylesheets/blacklight/_facets.css.scss +6 -0
- data/app/assets/stylesheets/blacklight/_group.css.scss +14 -0
- data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +1 -0
- data/app/controllers/bookmarks_controller.rb +2 -2
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +41 -24
- data/app/helpers/blacklight/catalog_helper_behavior.rb +48 -28
- data/app/helpers/blacklight/facets_helper_behavior.rb +9 -75
- data/app/models/record_mailer.rb +1 -16
- data/app/views/bookmarks/index.html.erb +2 -0
- data/app/views/catalog/_bookmark_control.html.erb +3 -4
- data/app/views/catalog/_document.html.erb +2 -1
- data/app/views/catalog/_document_header.html.erb +6 -3
- data/app/views/catalog/_email_form.html.erb +0 -7
- data/app/views/catalog/_facet_layout.html.erb +1 -1
- data/app/views/catalog/_group_default.html.erb +12 -0
- data/app/views/catalog/_index_default.html.erb +1 -1
- data/app/views/catalog/_opensearch_response_metadata.html.erb +2 -3
- data/app/views/catalog/_paginate_compact.html.erb +2 -2
- data/app/views/catalog/_results_pagination.html.erb +2 -2
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/app/views/catalog/_sms_form.html.erb +1 -21
- data/app/views/catalog/_thumbnail_default.html.erb +5 -0
- data/app/views/catalog/email_sent.html.erb +9 -0
- data/app/views/catalog/index.atom.builder +7 -8
- data/app/views/catalog/index.html.erb +6 -3
- data/app/views/catalog/librarian_view.html.erb +1 -1
- data/app/views/catalog/sms_sent.html.erb +9 -0
- data/app/views/feedback/complete.html.erb +2 -0
- data/app/views/feedback/show.html.erb +7 -5
- data/app/views/kaminari/blacklight_compact/_paginator.html.erb +1 -1
- data/app/views/layouts/blacklight.html.erb +1 -2
- data/app/views/saved_searches/index.html.erb +2 -0
- data/app/views/search_history/index.html.erb +1 -1
- data/blacklight.gemspec +1 -1
- data/config/locales/blacklight.en.yml +11 -0
- data/config/locales/blacklight.fr.yml +15 -1
- data/gemfiles/rails3.gemfile +7 -0
- data/gemfiles/rails4.gemfile +7 -0
- data/lib/blacklight.rb +1 -0
- data/lib/blacklight/catalog.rb +101 -56
- data/lib/blacklight/configuration.rb +1 -1
- data/lib/blacklight/controller.rb +7 -4
- data/lib/blacklight/facet.rb +79 -0
- data/lib/blacklight/routes.rb +0 -1
- data/lib/blacklight/solr/document.rb +4 -0
- data/lib/blacklight/solr/document/marc_export.rb +1 -1
- data/lib/blacklight/solr_helper.rb +39 -8
- data/lib/blacklight/solr_response.rb +35 -3
- data/lib/blacklight/solr_response/facets.rb +4 -0
- data/lib/blacklight/solr_response/group.rb +33 -0
- data/lib/blacklight/solr_response/group_response.rb +49 -0
- data/lib/blacklight/solr_response/pagination_methods.rb +27 -0
- data/lib/blacklight/user.rb +30 -32
- data/lib/generators/blacklight/assets_generator.rb +3 -1
- data/lib/generators/blacklight/blacklight_generator.rb +28 -125
- data/lib/generators/blacklight/marc_generator.rb +66 -0
- data/lib/generators/blacklight/models_generator.rb +113 -0
- data/lib/generators/blacklight/templates/alternate_controller.rb +9 -0
- data/lib/generators/blacklight/templates/config/solr.yml +0 -2
- data/lib/generators/blacklight/templates/solr_document.rb +1 -13
- data/lib/railties/all_tests.rake +5 -8
- data/spec/controllers/catalog_controller_spec.rb +185 -113
- data/spec/features/alternate_controller_spec.rb +34 -0
- data/spec/features/bookmarks_spec.rb +58 -0
- data/spec/features/did_you_mean_spec.rb +135 -0
- data/spec/features/librarian_view_spec.rb +13 -0
- data/spec/features/record_view_spec.rb +37 -0
- data/spec/features/saved_searches_spec.rb +47 -0
- data/spec/features/search_filters_spec.rb +137 -0
- data/spec/features/search_history_spec.rb +75 -0
- data/spec/features/search_pagination_spec.rb +91 -0
- data/spec/features/search_results_spec.rb +68 -0
- data/spec/features/search_sort_spec.rb +20 -0
- data/spec/features/search_spec.rb +108 -0
- data/spec/helpers/blacklight_helper_spec.rb +45 -2
- data/spec/helpers/catalog_helper_spec.rb +134 -1
- data/spec/helpers/facets_helper_spec.rb +8 -0
- data/spec/lib/blacklight/solr_response/group_response_spec.rb +78 -0
- data/spec/lib/blacklight/solr_response/group_spec.rb +70 -0
- data/spec/lib/blacklight_solr_response_spec.rb +11 -5
- data/spec/lib/blacklight_user_spec.rb +22 -41
- data/spec/lib/solr_helper_spec.rb +73 -1
- data/spec/models/record_mailer_spec.rb +3 -3
- data/spec/models/{solr_docment_spec.rb → solr_document_spec.rb} +1 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/support/features.rb +7 -0
- data/spec/support/features/session_helpers.rb +22 -0
- data/spec/test_app_templates/Gemfile.extra +0 -4
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -6
- data/spec/test_app_templates/lib/tasks/blacklight_test_app.rake +1 -9
- data/spec/views/catalog/_facets.html.erb_spec.rb +2 -1
- data/tasks/blacklight.rake +0 -10
- metadata +49 -58
- data/features/bookmarks.feature +0 -68
- data/features/did_you_mean.feature +0 -123
- data/features/librarian_view.feature +0 -18
- data/features/record_view.feature +0 -40
- data/features/saved_searches.feature +0 -49
- data/features/search.feature +0 -83
- data/features/search_filters.feature +0 -119
- data/features/search_history.feature +0 -85
- data/features/search_pagination.feature +0 -53
- data/features/search_results.feature +0 -61
- data/features/search_sort.feature +0 -27
- data/features/step_definitions/bookmarks_steps.rb +0 -6
- data/features/step_definitions/error_steps.rb +0 -5
- data/features/step_definitions/general_steps.rb +0 -50
- data/features/step_definitions/record_view_steps.rb +0 -12
- data/features/step_definitions/saved_searches_steps.rb +0 -19
- data/features/step_definitions/search_facets_steps.rb +0 -29
- data/features/step_definitions/search_history_steps.rb +0 -9
- data/features/step_definitions/search_pagination_steps.rb +0 -29
- data/features/step_definitions/search_result_steps.rb +0 -115
- data/features/step_definitions/search_steps.rb +0 -118
- data/features/step_definitions/user_steps.rb +0 -5
- data/features/step_definitions/web_steps.rb +0 -217
- data/features/support/env.rb +0 -65
- data/features/support/paths.rb +0 -48
- data/features/support/selectors.rb +0 -40
- data/lib/railties/blacklight_cucumber.rake +0 -126
- data/lib/solrmarc.log.1 +0 -854
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "Did You Mean" do
|
|
4
|
+
before { visit root_path }
|
|
5
|
+
|
|
6
|
+
describe "searching all fields" do
|
|
7
|
+
it "should have suggestions" do
|
|
8
|
+
fill_in "q", with: 'politica'
|
|
9
|
+
click_button 'search'
|
|
10
|
+
|
|
11
|
+
expect(page).to have_content("Did you mean")
|
|
12
|
+
click_link 'policy'
|
|
13
|
+
within ("#sortAndPerPage") do
|
|
14
|
+
expect(page).to have_content "1 - 2 of 2"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe "for a title search" do
|
|
20
|
+
before { select 'Title', from: 'search_field' }
|
|
21
|
+
it "should have suggestions" do
|
|
22
|
+
# yehudiyam is one letter away from a title word
|
|
23
|
+
fill_in "q", with: 'yehudiyam'
|
|
24
|
+
click_button 'search'
|
|
25
|
+
|
|
26
|
+
expect(page).to have_content("Did you mean")
|
|
27
|
+
click_link 'yehudiyim'
|
|
28
|
+
within ("#sortAndPerPage") do
|
|
29
|
+
expect(page).to have_content "1 to 1 of 1"
|
|
30
|
+
end
|
|
31
|
+
within ("select#search_field") do
|
|
32
|
+
expect(page).to have_selector("option[selected]", text: "Title")
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe "for an author search" do
|
|
38
|
+
before { select 'Author', from: 'search_field' }
|
|
39
|
+
it "should have suggestions" do
|
|
40
|
+
# shirma is one letter away from an author word
|
|
41
|
+
fill_in "q", with: 'shirma'
|
|
42
|
+
click_button 'search'
|
|
43
|
+
|
|
44
|
+
expect(page).to have_content("Did you mean")
|
|
45
|
+
click_link 'sharma'
|
|
46
|
+
within ("#sortAndPerPage") do
|
|
47
|
+
expect(page).to have_content "1 to 1 of 1"
|
|
48
|
+
end
|
|
49
|
+
within ("select#search_field") do
|
|
50
|
+
expect(page).to have_selector("option[selected]", text: "Author")
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
describe "for an subject search" do
|
|
56
|
+
before { select 'Subject', from: 'search_field' }
|
|
57
|
+
it "should have suggestions" do
|
|
58
|
+
# wome is one letter away from an author word
|
|
59
|
+
fill_in "q", with: 'wome'
|
|
60
|
+
click_button 'search'
|
|
61
|
+
|
|
62
|
+
expect(page).to have_content("Did you mean")
|
|
63
|
+
click_link 'women'
|
|
64
|
+
within ("#sortAndPerPage") do
|
|
65
|
+
expect(page).to have_content "1 - 3 of 3"
|
|
66
|
+
end
|
|
67
|
+
within ("select#search_field") do
|
|
68
|
+
expect(page).to have_selector("option[selected]", text: "Subject")
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
describe "a multiword query" do
|
|
74
|
+
it "should not have suggestions if there are no matches" do
|
|
75
|
+
fill_in "q", with: 'ooofda ooofda'
|
|
76
|
+
click_button 'search'
|
|
77
|
+
|
|
78
|
+
expect(page).to_not have_content("Did you mean")
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it "should have separate suggestions" do
|
|
82
|
+
fill_in "q", with: 'politica boo'
|
|
83
|
+
click_button 'search'
|
|
84
|
+
|
|
85
|
+
within(".suggest") do
|
|
86
|
+
expect(page).to have_content("Did you mean")
|
|
87
|
+
expect(page).to have_link('policy')
|
|
88
|
+
expect(page).to have_link('bon')
|
|
89
|
+
expect(page).not_to have_link('policy bon')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
click_link 'bon'
|
|
93
|
+
within ("#sortAndPerPage") do
|
|
94
|
+
expect(page).to have_content "1 to 1 of 1"
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it "should ignore repeated terms" do
|
|
99
|
+
fill_in "q", with: 'boo boo'
|
|
100
|
+
click_button 'search'
|
|
101
|
+
|
|
102
|
+
within(".suggest") do
|
|
103
|
+
expect(page).to have_content("Did you mean")
|
|
104
|
+
expect(page).to have_link('bon', count: 1)
|
|
105
|
+
expect(page).not_to have_link('bon bon')
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
it "should show suggestions if there aren't many hits" do
|
|
111
|
+
fill_in "q", with: 'ayaz'
|
|
112
|
+
click_button 'search'
|
|
113
|
+
|
|
114
|
+
expect(page).to have_content("Did you mean")
|
|
115
|
+
click_link 'bya'
|
|
116
|
+
within ("#sortAndPerPage") do
|
|
117
|
+
expect(page).to have_content "1 - 3 of 3"
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
it "should should not show suggestions if there are many results" do
|
|
122
|
+
# histori gives 9 results in 30 record demo index
|
|
123
|
+
fill_in "q", with: 'histori'
|
|
124
|
+
click_button 'search'
|
|
125
|
+
expect(page).to_not have_content("Did you mean")
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
it "should should show suggestions if at the threshold number" do
|
|
129
|
+
# polit gives 5 results in 30 record demo index - 5 is default cutoff
|
|
130
|
+
fill_in "q", with: 'polit'
|
|
131
|
+
click_button 'search'
|
|
132
|
+
expect(page).to have_content("Did you mean")
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "Librarian view" do
|
|
4
|
+
it "should show marc fields" do
|
|
5
|
+
visit catalog_path('2009373513')
|
|
6
|
+
click_link "Librarian View"
|
|
7
|
+
expect(page).to have_content "Librarian View"
|
|
8
|
+
expect(page).to have_content "LEADER 01213nam a22003614a 4500"
|
|
9
|
+
expect(page).to have_content "100"
|
|
10
|
+
expect(page).to have_content "Lin, Xingzhi."
|
|
11
|
+
expect(page).to have_content "6|"
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
|
|
4
|
+
describe "Record View" do
|
|
5
|
+
it "should display a normal record" do
|
|
6
|
+
visit catalog_path('2007020969')
|
|
7
|
+
expect(page).to have_content "Title:"
|
|
8
|
+
expect(page).to have_content "Strong Medicine speaks"
|
|
9
|
+
expect(page).to have_content "Subtitle:"
|
|
10
|
+
expect(page).to have_content "a Native American elder has her say : an oral history"
|
|
11
|
+
expect(page).to have_content "Author:"
|
|
12
|
+
expect(page).to have_content "Hearth, Amy Hill, 1958-"
|
|
13
|
+
expect(page).to have_content "Format:"
|
|
14
|
+
expect(page).to have_content "Book"
|
|
15
|
+
expect(page).to have_content "Call number:"
|
|
16
|
+
expect(page).to have_content "E99.D2 H437 2008"
|
|
17
|
+
expect(page).to have_selector("link[rel=alternate]")
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "should not display blank titles" do
|
|
22
|
+
visit catalog_path('2008305903')
|
|
23
|
+
expect(page).not_to have_content "More Information:"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "should not display vernacular records" do
|
|
27
|
+
visit catalog_path('2009373513')
|
|
28
|
+
expect(page).to have_content "次按驟變"
|
|
29
|
+
expect(page).to have_content "林行止"
|
|
30
|
+
expect(page).to have_content "臺北縣板橋市"
|
|
31
|
+
end
|
|
32
|
+
it "should not display 404" do
|
|
33
|
+
visit catalog_path('this_id_does_not_exist')
|
|
34
|
+
page.driver.status_code.should == 404
|
|
35
|
+
expect(page).to have_content "Sorry, you have requested a record that doesn't exist."
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "Saved Searches" do
|
|
4
|
+
before do
|
|
5
|
+
sign_in 'user1'
|
|
6
|
+
visit root_path
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should be empty" do
|
|
10
|
+
click_link 'Saved Searches'
|
|
11
|
+
expect(page).to have_content 'You have no saved searches'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe "with a saved search 'book'" do
|
|
15
|
+
before do
|
|
16
|
+
fill_in "q", with: 'book'
|
|
17
|
+
click_button 'search'
|
|
18
|
+
click_link "History"
|
|
19
|
+
click_button "save"
|
|
20
|
+
click_link 'Saved Searches'
|
|
21
|
+
end
|
|
22
|
+
it "should show saved searches" do
|
|
23
|
+
expect(page).to have_content 'Your saved searches'
|
|
24
|
+
expect(page).to have_content 'book'
|
|
25
|
+
end
|
|
26
|
+
it "should delete saved searches" do
|
|
27
|
+
click_button 'delete'
|
|
28
|
+
expect(page).to have_content 'Successfully removed that saved search.'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe "and a saved search 'dang'" do
|
|
32
|
+
before do
|
|
33
|
+
visit root_path
|
|
34
|
+
fill_in "q", with: 'dang'
|
|
35
|
+
click_button 'search'
|
|
36
|
+
click_link "History"
|
|
37
|
+
click_button "save"
|
|
38
|
+
click_link 'Saved Searches'
|
|
39
|
+
end
|
|
40
|
+
it "should clear the searhes" do
|
|
41
|
+
click_link "Clear Saved Searches"
|
|
42
|
+
expect(page).to have_content 'Cleared your saved searches.'
|
|
43
|
+
expect(page).to have_content 'You have no saved searches'
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "Facets" do
|
|
4
|
+
it "should work without a search term" do
|
|
5
|
+
visit root_path
|
|
6
|
+
click_link "Tibetan"
|
|
7
|
+
within ("#sortAndPerPage") do
|
|
8
|
+
expect(page).to have_content "1 - 6 of 6"
|
|
9
|
+
end
|
|
10
|
+
within(".blacklight-language_facet") do
|
|
11
|
+
expect(page).to have_selector("span.selected", :text => "Tibetan 6")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
click_link "India"
|
|
15
|
+
within ("#sortAndPerPage") do
|
|
16
|
+
expect(page).to have_content "1 - 2 of 2"
|
|
17
|
+
end
|
|
18
|
+
within(".blacklight-language_facet") do
|
|
19
|
+
expect(page).to have_selector("span.selected", :text => "Tibetan 2")
|
|
20
|
+
end
|
|
21
|
+
within(".blacklight-subject_geo_facet") do
|
|
22
|
+
expect(page).to have_selector("span.selected", :text => "India 2")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "should work in conjunction with a search term" do
|
|
27
|
+
visit root_path
|
|
28
|
+
fill_in "q", with: 'history'
|
|
29
|
+
click_button 'search'
|
|
30
|
+
within ("#sortAndPerPage") do
|
|
31
|
+
expect(page).to have_content "1 - 9 of 9"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
click_link "Tibetan"
|
|
35
|
+
within ("#sortAndPerPage") do
|
|
36
|
+
expect(page).to have_content "1 - 2 of 2"
|
|
37
|
+
end
|
|
38
|
+
within(".blacklight-language_facet") do
|
|
39
|
+
expect(page).to have_selector("span.selected", :text => "Tibetan 2")
|
|
40
|
+
end
|
|
41
|
+
within "#appliedParams" do
|
|
42
|
+
expect(page).to have_content "You searched for:"
|
|
43
|
+
expect(page).to have_content "history"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
click_link "2004"
|
|
47
|
+
|
|
48
|
+
within ("#sortAndPerPage") do
|
|
49
|
+
expect(page).to have_content "1 to 1 of 1"
|
|
50
|
+
end
|
|
51
|
+
within(".blacklight-language_facet") do
|
|
52
|
+
expect(page).to have_selector("span.selected", :text => "Tibetan 1")
|
|
53
|
+
end
|
|
54
|
+
within(".blacklight-pub_date") do
|
|
55
|
+
expect(page).to have_selector("span.selected", :text => "2004 1")
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "should allow removing filters" do
|
|
60
|
+
visit root_path
|
|
61
|
+
click_link "Tibetan"
|
|
62
|
+
within(".blacklight-language_facet") do
|
|
63
|
+
expect(page).to have_selector("span.selected", :text => "Tibetan 6")
|
|
64
|
+
end
|
|
65
|
+
within(".blacklight-language_facet") do
|
|
66
|
+
click_link 'remove'
|
|
67
|
+
end
|
|
68
|
+
expect(page).to_not have_link 'remove'
|
|
69
|
+
expect(page).to have_content('Welcome!')
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it "should retain filters when you change the search term" do
|
|
73
|
+
visit root_path
|
|
74
|
+
fill_in "q", with: 'history'
|
|
75
|
+
click_button 'search'
|
|
76
|
+
click_link 'Tibetan'
|
|
77
|
+
within(".blacklight-language_facet") do
|
|
78
|
+
expect(page).to have_selector("span.selected", :text => "Tibetan 2")
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
click_link '2004'
|
|
82
|
+
|
|
83
|
+
within(".blacklight-language_facet") do
|
|
84
|
+
expect(page).to have_selector("span.selected", :text => "Tibetan 1")
|
|
85
|
+
end
|
|
86
|
+
within(".blacklight-pub_date") do
|
|
87
|
+
expect(page).to have_selector("span.selected", :text => "2004 1")
|
|
88
|
+
end
|
|
89
|
+
fill_in "q", with: 'china'
|
|
90
|
+
click_button 'search'
|
|
91
|
+
|
|
92
|
+
within(".blacklight-language_facet") do
|
|
93
|
+
expect(page).to have_selector("span.selected", :text => "Tibetan 1")
|
|
94
|
+
end
|
|
95
|
+
within(".blacklight-pub_date") do
|
|
96
|
+
expect(page).to have_selector("span.selected", :text => "2004 1")
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
it "should retain the filters when we change sort" do
|
|
101
|
+
visit root_path
|
|
102
|
+
fill_in "q", with: 'history'
|
|
103
|
+
click_button 'search'
|
|
104
|
+
click_link 'Tibetan'
|
|
105
|
+
within(".blacklight-language_facet") do
|
|
106
|
+
expect(page).to have_selector("span.selected", :text => "Tibetan 2")
|
|
107
|
+
end
|
|
108
|
+
click_link 'title'
|
|
109
|
+
within(".blacklight-language_facet") do
|
|
110
|
+
expect(page).to have_selector("span.selected", :text => "Tibetan 2")
|
|
111
|
+
end
|
|
112
|
+
within "#appliedParams" do
|
|
113
|
+
expect(page).to have_content "You searched for:"
|
|
114
|
+
expect(page).to have_content "history"
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
it "should retain the filters when we change per page number" do
|
|
119
|
+
visit root_path
|
|
120
|
+
fill_in "q", with: 'history'
|
|
121
|
+
click_button 'search'
|
|
122
|
+
click_link 'Tibetan'
|
|
123
|
+
within(".blacklight-language_facet") do
|
|
124
|
+
expect(page).to have_selector("span.selected", :text => "Tibetan 2")
|
|
125
|
+
end
|
|
126
|
+
within '#per_page-dropdown' do
|
|
127
|
+
click_link '20'
|
|
128
|
+
end
|
|
129
|
+
within(".blacklight-language_facet") do
|
|
130
|
+
expect(page).to have_selector("span.selected", :text => "Tibetan 2")
|
|
131
|
+
end
|
|
132
|
+
within "#appliedParams" do
|
|
133
|
+
expect(page).to have_content "You searched for:"
|
|
134
|
+
expect(page).to have_content "history"
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "Search History Page" do
|
|
4
|
+
describe "navigating from the homepage" do
|
|
5
|
+
it "should have a link to the history page" do
|
|
6
|
+
visit root_path
|
|
7
|
+
click_link 'History'
|
|
8
|
+
expect(page).to have_content 'Search History'
|
|
9
|
+
expect(page).to have_content 'You have no search history'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe "when I have done a search" do
|
|
14
|
+
before do
|
|
15
|
+
visit root_path
|
|
16
|
+
fill_in "q", with: 'book'
|
|
17
|
+
click_button 'search'
|
|
18
|
+
click_link 'History'
|
|
19
|
+
end
|
|
20
|
+
it "should show searches" do
|
|
21
|
+
expect(page).to have_content 'Your recent searches'
|
|
22
|
+
expect(page).to have_content 'book'
|
|
23
|
+
expect(page).to_not have_content 'dang'
|
|
24
|
+
visit root_path
|
|
25
|
+
fill_in "q", with: 'dang'
|
|
26
|
+
click_button 'search'
|
|
27
|
+
click_link 'History'
|
|
28
|
+
expect(page).to have_content 'book'
|
|
29
|
+
expect(page).to have_content 'dang'
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe "when i've done several searches" do
|
|
34
|
+
before do
|
|
35
|
+
visit root_path
|
|
36
|
+
fill_in "q", with: 'book'
|
|
37
|
+
click_button 'search'
|
|
38
|
+
fill_in "q", with: 'dang'
|
|
39
|
+
click_button 'search'
|
|
40
|
+
click_link 'History'
|
|
41
|
+
end
|
|
42
|
+
it "should be able to clear the history" do
|
|
43
|
+
click_link "Clear Search History"
|
|
44
|
+
expect(page).to have_content 'Cleared your search history.'
|
|
45
|
+
expect(page).to have_content 'You have no search history'
|
|
46
|
+
expect(page).to_not have_content 'book'
|
|
47
|
+
expect(page).to_not have_content 'dang'
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
describe "when logged in" do
|
|
52
|
+
before do
|
|
53
|
+
sign_in 'user1'
|
|
54
|
+
fill_in "q", with: 'book'
|
|
55
|
+
click_button 'search'
|
|
56
|
+
click_link 'History'
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "should save and forget the search" do
|
|
60
|
+
click_button 'save'
|
|
61
|
+
expect(page).to have_content 'Successfully saved your search.'
|
|
62
|
+
click_button 'forget'
|
|
63
|
+
expect(page).to have_content 'Successfully removed that saved search.'
|
|
64
|
+
expect(page).to have_button 'save'
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it "should not show results after logging out" do
|
|
68
|
+
click_button 'save'
|
|
69
|
+
expect(page).to have_content 'Successfully saved your search.'
|
|
70
|
+
click_link 'Log Out'
|
|
71
|
+
click_link 'History'
|
|
72
|
+
expect(page).to_not have_content 'book'
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|