12345678910111213141516171819202122232425262728293031323334353637 |
- # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
- require 'rails_helper'
- RSpec.describe HtmlSanitizer::Scrubber::QuoteContent do
- let(:scrubber) { described_class.new }
- describe('#scrubber') do
- subject(:actual) do
- # export with extra options to avoid html indentation
- fragment.scrub!(scrubber)
- .to_html save_with: Nokogiri::XML::Node::SaveOptions::DEFAULT_HTML ^ Nokogiri::XML::Node::SaveOptions::FORMAT
- end
- before do
- allow(Rails.application.config)
- .to receive(:html_sanitizer_tags_quote_content)
- .and_return(%w[tag-to-quote])
- end
- let(:fragment) { Loofah.fragment(input) }
- context 'when tag-to-quote div' do
- let(:input) { '<tag-to-quote><div>&content</div></tag-to-quote>' }
- let(:target) { '&content' }
- it { is_expected.to eq target }
- end
- context 'when div' do
- let(:input) { '<div>&content</div>' }
- let(:target) { '<div>&content</div>' }
- it { is_expected.to eq target }
- end
- end
- end
|