-
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.
HYC-1985 - Display expected formatting for rich text fields (#1127)
* Sanitize html from abstract field in search results * Permit style attributes and blockquotes through the formatted text renderer * Rubocop
- Loading branch information
Showing
6 changed files
with
35 additions
and
5 deletions.
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# frozen_string_literal: true | ||
module ApplicationHelper | ||
def sanitize_abstract_field(options = {}) | ||
options[:value].map { |v| ActionController::Base.helpers.strip_tags(v) }.join(' and ') | ||
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
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,27 @@ | ||
# frozen_string_literal: true | ||
require 'rails_helper' | ||
require Rails.root.join('spec/support/oai_sample_solr_documents.rb') | ||
include Warden::Test::Helpers | ||
|
||
RSpec.describe 'Search Results', type: :feature, js: false do | ||
let(:solr) { Blacklight.default_index.connection } | ||
|
||
before do | ||
solr.delete_by_query('*:*') # delete everything in Solr | ||
solr.add([SLEEPY_HOLLOW, MYSTERIOUS_AFFAIR, TIME_MACHINE]) | ||
solr.commit | ||
end | ||
|
||
after do | ||
solr.delete_by_query('*:*') | ||
solr.commit | ||
end | ||
|
||
it 'html tags are stripped from abstract field' do | ||
visit '/catalog' | ||
expect(page).to have_content(SLEEPY_HOLLOW[:title_tesim][0]) | ||
expect(page).to have_content(MYSTERIOUS_AFFAIR[:title_tesim][0]) | ||
expect(page).to have_content(TIME_MACHINE[:title_tesim][0]) | ||
expect(page).to have_content('Actual Abstract and another abstract') | ||
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