diff options
Diffstat (limited to 'spec/support_specs/helpers/html_escaped_helpers_spec.rb')
-rw-r--r-- | spec/support_specs/helpers/html_escaped_helpers_spec.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/support_specs/helpers/html_escaped_helpers_spec.rb b/spec/support_specs/helpers/html_escaped_helpers_spec.rb new file mode 100644 index 00000000000..337f7ecc659 --- /dev/null +++ b/spec/support_specs/helpers/html_escaped_helpers_spec.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +require 'fast_spec_helper' +require 'rspec-parameterized' + +require_relative '../../support/helpers/html_escaped_helpers' + +RSpec.describe HtmlEscapedHelpers do + using RSpec::Parameterized::TableSyntax + + describe '#match_html_escaped_tags' do + let(:actual_match) { actual_match_data && actual_match_data[0] } + + subject(:actual_match_data) { described_class.match_html_escaped_tags(content) } + + where(:content, :expected_match) do + nil | nil + '' | nil + '<a href' | nil + '<span href' | nil + '</a>' | nil + '<a href' | '<a' + '<span href' | '<span' + '< span' | '< span' + 'some text <a href' | '<a' + 'some text "<a href' | '<a' + '</a&glt;' | '</a' + '</span>' | '</span' + '< / span>' | '< / span' + 'title="<a href' | nil + 'title= "<a href' | nil + "title= '<a href" | nil + "title= '</a" | nil + "title= '</span" | nil + 'title="foo"><a' | '<a' + "title='foo'>\n<a" | '<a' + end + + with_them do + specify { expect(actual_match).to eq(expected_match) } + end + end +end |