summaryrefslogtreecommitdiff
path: root/spec/haml_lint
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /spec/haml_lint
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
downloadgitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/haml_lint')
-rw-r--r--spec/haml_lint/linter/no_plain_nodes_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/haml_lint/linter/no_plain_nodes_spec.rb b/spec/haml_lint/linter/no_plain_nodes_spec.rb
index 08deb5a4e9e..dc647467db6 100644
--- a/spec/haml_lint/linter/no_plain_nodes_spec.rb
+++ b/spec/haml_lint/linter/no_plain_nodes_spec.rb
@@ -53,4 +53,42 @@ describe HamlLint::Linter::NoPlainNodes do
it { is_expected.to report_lint count: 3 }
end
+
+ context 'does not report when a html entity' do
+ let(:haml) { '%tag &nbsp;' }
+
+ it { is_expected.not_to report_lint }
+ end
+
+ context 'does report when something that looks like a html entity' do
+ let(:haml) { '%tag &some text;' }
+
+ it { is_expected.to report_lint }
+ end
+
+ context 'does not report multiline when one or more html entities' do
+ %w(&nbsp;&gt; &#x000A9; &#187;).each do |elem|
+ let(:haml) { <<-HAML }
+ %tag
+ #{elem}
+ HAML
+
+ it elem do
+ is_expected.not_to report_lint
+ end
+ end
+ end
+
+ context 'does report multiline when one or more html entities amidst plain text' do
+ %w(&nbsp;Test Test&gt; &#x000A9;Hello &nbsp;Hello&#187;).each do |elem|
+ let(:haml) { <<-HAML }
+ %tag
+ #{elem}
+ HAML
+
+ it elem do
+ is_expected.to report_lint
+ end
+ end
+ end
end