Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-15 18:13:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-15 18:13:49 +0300
commit229395d3af51cd46a9179f2eba142c027d08b208 (patch)
tree56efbeeb1bb9bf8e6f68174436cacd5c2d20fca4 /spec/support_specs
parent3107fe7203685580829c7d6ca56161e13acb83eb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support_specs')
-rw-r--r--spec/support_specs/helpers/html_escaped_helpers_spec.rb43
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
+ '&lt;a href' | '&lt;a'
+ '&lt;span href' | '&lt;span'
+ '&lt; span' | '&lt; span'
+ 'some text &lt;a href' | '&lt;a'
+ 'some text "&lt;a href' | '&lt;a'
+ '&lt;/a&glt;' | '&lt;/a'
+ '&lt;/span&gt;' | '&lt;/span'
+ '&lt; / span&gt;' | '&lt; / span'
+ 'title="&lt;a href' | nil
+ 'title= "&lt;a href' | nil
+ "title= '&lt;a href" | nil
+ "title= '&lt;/a" | nil
+ "title= '&lt;/span" | nil
+ 'title="foo">&lt;a' | '&lt;a'
+ "title='foo'>\n&lt;a" | '&lt;a'
+ end
+
+ with_them do
+ specify { expect(actual_match).to eq(expected_match) }
+ end
+ end
+end