Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ff9ed116
Commit
ff9ed116
authored
Mar 04, 2021
by
Rajendra Kadam
Committed by
Peter Leitzen
Mar 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for emoji and custom emoji filters for ignored tags
parent
83b0a4b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
3 deletions
+36
-3
spec/lib/banzai/filter/custom_emoji_filter_spec.rb
spec/lib/banzai/filter/custom_emoji_filter_spec.rb
+9
-3
spec/lib/banzai/filter/emoji_filter_spec.rb
spec/lib/banzai/filter/emoji_filter_spec.rb
+6
-0
spec/support/shared_examples/banzai/filters/ignored_tags_emoji_shared_examples.rb
...ples/banzai/filters/ignored_tags_emoji_shared_examples.rb
+21
-0
No files found.
spec/lib/banzai/filter/custom_emoji_filter_spec.rb
View file @
ff9ed116
...
...
@@ -18,10 +18,10 @@ RSpec.describe Banzai::Filter::CustomEmojiFilter do
end
it
'ignores non existent custom emoji'
do
exp
=
act
=
'<p>:foo:</p>'
doc
=
filter
(
act
)
exp
=
'<p>:foo:</p>'
doc
=
filter
(
exp
)
expect
(
doc
.
to_html
).
to
match
Regexp
.
escape
(
exp
)
expect
(
doc
.
to_html
).
to
eq
(
exp
)
end
it
'correctly uses the custom emoji URL'
do
...
...
@@ -77,4 +77,10 @@ RSpec.describe Banzai::Filter::CustomEmojiFilter do
filter
(
'<p>:tanuki: :party-parrot:</p>'
)
end
.
not_to
exceed_all_query_limit
(
control_count
.
count
)
end
context
'ancestor tags'
do
let
(
:emoji_name
)
{
':tanuki:'
}
it_behaves_like
'ignored ancestor tags'
end
end
spec/lib/banzai/filter/emoji_filter_spec.rb
View file @
ff9ed116
...
...
@@ -117,4 +117,10 @@ RSpec.describe Banzai::Filter::EmojiFilter do
expect
(
doc
.
to_html
).
to
match
(
/^This deserves a <gl-emoji.+>, big time\.\z/
)
end
context
'ancestor tags'
do
let
(
:emoji_name
)
{
':see_no_evil:'
}
it_behaves_like
'ignored ancestor tags'
end
end
spec/support/shared_examples/banzai/filters/ignored_tags_emoji_shared_examples.rb
0 → 100644
View file @
ff9ed116
# frozen_string_literal: true
RSpec
.
shared_examples
'ignored ancestor tags'
do
it
'does not match emoji in a pre tag'
do
doc
=
filter
(
"<p><pre>
#{
emoji_name
}
</pre></p>"
)
expect
(
doc
.
css
(
'img'
).
size
).
to
eq
0
end
it
'does not match emoji in code tag'
do
doc
=
filter
(
"<p><code>
#{
emoji_name
}
wow</code></p>"
)
expect
(
doc
.
css
(
'img'
).
size
).
to
eq
0
end
it
'does not match emoji in tt tag'
do
doc
=
filter
(
"<p><tt>
#{
emoji_name
}
yes!</tt></p>"
)
expect
(
doc
.
css
(
'img'
).
size
).
to
eq
0
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment