spec/features/update_appearance_spec.rb in blacklight-spotlight-0.1.0 vs spec/features/update_appearance_spec.rb in blacklight-spotlight-0.2.0

- old
+ new

@@ -1,49 +1,73 @@ require 'spec_helper' -describe "Update the appearance" do +describe "Update the appearance", :type => :feature do let(:exhibit) { FactoryGirl.create(:exhibit) } let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) } before { login_as user } it "should update appearance options" do visit spotlight.exhibit_dashboard_path(exhibit) within "#sidebar" do click_link "Appearance" end + uncheck "Searchable (offer searchbox and facet sidebar)" + uncheck "List" choose "20" - choose "Large" - # #feild_labeled doesn't appear to work for disabled inputs - expect(page).to have_css("input[name='appearance[sort_fields][relevance]'][disabled='disabled']") - uncheck "Title" - uncheck "Identifier" + expect(page).to have_css("input[name='appearance[sort_fields][relevance][enable]'][disabled='disabled']") + expect(page).to have_css("#nested-sort-fields .dd-item:nth-child(5) h3", text: "Identifier") + uncheck "appearance_sort_fields_title_enabled" + uncheck "appearance_sort_fields_identifier_enabled" + + find("#appearance_sort_fields_type_weight").set("100") + click_button "Save changes" expect(page).to have_content("The appearance was successfully updated.") within "#sidebar" do click_link "Appearance" end + expect(field_labeled('Searchable (offer searchbox and facet sidebar)')).to_not be_checked + expect(field_labeled('List')).to_not be_checked expect(field_labeled('Gallery')).to be_checked expect(field_labeled('20')).to be_checked expect(field_labeled('10')).to_not be_checked - expect(field_labeled('Large')).to be_checked - # #feild_labeled doesn't appear to work for disabled inputs - expect(page).to have_css("input[name='appearance[sort_fields][relevance]'][disabled='disabled']") - expect(field_labeled('Type')).to be_checked - expect(field_labeled('Date')).to be_checked - expect(field_labeled('Title')).to_not be_checked - expect(field_labeled('Identifier')).to_not be_checked + expect(page).to have_css("input[name='appearance[sort_fields][relevance][enable]'][disabled='disabled']") + expect(find("#appearance_sort_fields_type_enabled")).to be_checked + expect(find("#appearance_sort_fields_date_enabled")).to be_checked + expect(find("#appearance_sort_fields_title_enabled")).to_not be_checked + expect(find("#appearance_sort_fields_identifier_enabled")).to_not be_checked + # Type is now sorted last + expect(page).to have_css("#nested-sort-fields .dd-item:nth-child(5) h3", text: "Type") + end + + it "should hide search features when the exhibit is not searchable" do + visit spotlight.exhibit_dashboard_path(exhibit) + within "#sidebar" do + click_link "Appearance" + end + + uncheck "Searchable (offer searchbox and facet sidebar)" + + click_button "Save changes" + + visit spotlight.exhibit_root_path(exhibit) + + expect(page).to_not have_link "Saved Searches" + expect(page).to_not have_link "History" + expect(page).to_not have_content "Limit your search" + expect(page).to_not have_css ".search-query-form" end end