summaryrefslogtreecommitdiff
path: root/spec/haml_lint/linter/no_plain_nodes_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/haml_lint/linter/no_plain_nodes_spec.rb')
-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  ' }
+
+ 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( > © »).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