Sha256: d17f8f7715bfb1e99d6b1900618a88035afcc1e1e60e2556c2a22d2897886b24
Contents?: true
Size: 2 KB
Versions: 14
Compression:
Stored size: 2 KB
Contents
describe 'spotlight/search_configurations/_search_fields', type: :view do let(:exhibit) { FactoryGirl.create(:exhibit) } let(:f) do form_helper = nil controller.view_context.bootstrap_form_for(exhibit.blacklight_configuration, url: '/update') do |f| form_helper = f end form_helper end before do assign(:exhibit, exhibit) assign(:blacklight_configuration, exhibit.blacklight_configuration) allow(view).to receive_messages(current_exhibit: exhibit) exhibit.blacklight_config.add_search_field 'some_hidden_field', include_in_simple_select: false exhibit.blacklight_config.add_search_field 'some_field with_a_space' render partial: 'spotlight/search_configurations/search_fields', locals: { f: f } end it 'has a fieldset with an appropriate legend' do expect(rendered).to have_selector 'fieldset legend', text: 'Field-based search' end it 'has a checkbox to enable or disable fielded search' do expect(rendered).to have_selector 'input[data-behavior="enable-feature"][data-target="#search_fields"]' end it 'has a read-only "everything" search option' do expect(rendered).to have_selector "input[name='blacklight_configuration[search_fields][all_fields][enabled]'][data-readonly='true']" end it 'has search options for available search fields' do expect(rendered).to have_selector "input[name='blacklight_configuration[search_fields][title][enabled]']" expect(rendered).to have_selector "input[name='blacklight_configuration[search_fields][author][enabled]']" end it 'excludes search options that do not show up in the search dropdown' do expect(rendered).not_to have_selector "input[name='blacklight_configuration[search_fields][autocomplete][enabled]']" expect(rendered).not_to have_selector "input[name='blacklight_configuration[search_fields][some_hidden_field][enabled]']" end it 'parameterizes the data-id attribute for searcn field keh' do expect(rendered).to have_selector '[data-id="some_field-with_a_space-id"]' end end
Version data entries
14 entries across 14 versions & 1 rubygems