Skip to content

Commit

Permalink
Add class on documents container for the current view type
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Mar 11, 2015
1 parent 881c06d commit 4aedce6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/views/catalog/_document_list.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% # container for all documents in index view -%>
<div id="documents">
<% # container for all documents in index list view -%>
<div id="documents" class="documents-<%= document_index_view_type %>">
<%= render documents, :as => :document %>
</div>
2 changes: 1 addition & 1 deletion spec/helpers/blacklight_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ def mock_document_app_helper_url *args

it "should ignore missing templates" do
response = helper.render_document_index_with_view :view_type, [obj1, obj1]
expect(response).to match /<div id="documents">/
expect(response).to have_selector "div#documents"
end
end

Expand Down
11 changes: 8 additions & 3 deletions spec/views/catalog/_document_list.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
require 'spec_helper'

describe "/catalog/_document_list.html.erb" do


describe "catalog/_document_list", type: :view do

before do
allow(view).to receive_messages(document_index_view_type: "some-view", documents: [])
end

it "should include a class for the current view" do
render
expect(rendered).to have_selector(".documents-some-view")
end
end

0 comments on commit 4aedce6

Please sign in to comment.