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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
43dc6263
Commit
43dc6263
authored
Jan 24, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run tests in a single browser session
parent
79440890
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
66 deletions
+81
-66
spec/features/copy_as_gfm_spec.rb
spec/features/copy_as_gfm_spec.rb
+81
-66
No files found.
spec/features/copy_as_gfm_spec.rb
View file @
43dc6263
...
...
@@ -18,12 +18,18 @@ describe 'Copy as GFM', feature: true, js: true do
# To make sure these filters and handlers are properly aligned, this spec tests the GFM-to-HTML-to-GFM cycle
# by verifying (`html_to_gfm(gfm_to_html(gfm)) == gfm`) for a number of examples of GFM for every filter, using the `verify` helper.
it
'supports nesting'
do
verify
'> 1. [x] **[$`2 + 2`$ {-=-}{+=+} 2^2 ~~:thumbsup:~~](http://google.com)**'
end
# These are all in a single `it` for performance reasons.
it
'works'
,
:aggregate_failures
do
verify
(
'nesting'
,
'> 1. [x] **[$`2 + 2`$ {-=-}{+=+} 2^2 ~~:thumbsup:~~](http://google.com)**'
)
verify
(
'a real world example from the gitlab-ce README'
,
it
'supports a real world example from the gitlab-ce README'
do
verify
<<-
GFM
.
strip_heredoc
<<-
GFM
.
strip_heredoc
# GitLab
[![Build status](https://gitlab.com/gitlab-org/gitlab-ce/badges/master/build.svg)](https://gitlab.com/gitlab-org/gitlab-ce/commits/master)
...
...
@@ -52,26 +58,27 @@ describe 'Copy as GFM', feature: true, js: true do
- Completely free and open source (MIT Expat license)
GFM
end
)
it
'supports InlineDiffFilter'
do
verify
(
'InlineDiffFilter'
,
'{-Deleted text-}'
,
'{+Added text+}'
)
end
it
'supports TaskListFilter'
do
verify
(
'TaskListFilter'
,
'- [ ] Unchecked task'
,
'- [x] Checked task'
,
'1. [ ] Unchecked numbered task'
,
'1. [x] Checked numbered task'
)
end
it
'supports ReferenceFilter'
do
verify
(
'ReferenceFilter'
,
# issue reference
@feat
.
issue
.
to_reference
,
# full issue reference
...
...
@@ -85,31 +92,40 @@ describe 'Copy as GFM', feature: true, js: true do
# issue link with note anchor
"[Issue](
#{
namespace_project_issue_url
(
@project
.
namespace
,
@project
,
@feat
.
issue
,
anchor:
'note_123'
)
}
)"
,
)
end
it
'supports AutolinkFilter'
do
verify
'https://example.com'
end
verify
(
'AutolinkFilter'
,
it
'supports TableOfContentsFilter'
do
verify
'[[_TOC_]]'
end
'https://example.com'
)
it
'supports EmojiFilter'
do
verify
':thumbsup:'
end
verify
(
'TableOfContentsFilter'
,
it
'supports ImageLinkFilter'
do
verify
'![Image](https://example.com/image.png)'
end
'[[_TOC_]]'
)
it
'supports VideoLinkFilter'
do
verify
'![Video](https://example.com/video.mp4)'
end
verify
(
'EmojiFilter'
,
':thumbsup:'
)
context
'MathFilter'
do
it
'supports math as converted from GFM to HTML'
do
verify
(
'ImageLinkFilter'
,
'![Image](https://example.com/image.png)'
)
verify
(
'VideoLinkFilter'
,
'![Video](https://example.com/video.mp4)'
)
verify
(
'MathFilter: math as converted from GFM to HTML'
,
'$`c = \pm\sqrt{a^2 + b^2}`$'
,
# math block
...
...
@@ -119,9 +135,8 @@ describe 'Copy as GFM', feature: true, js: true do
```
GFM
)
end
it
'supports math as transformed from HTML to KaTeX'
do
aggregate_failures
(
'MathFilter: math as transformed from HTML to KaTeX'
)
do
gfm
=
'$`c = \pm\sqrt{a^2 + b^2}`$'
html
=
<<-
HTML
.
strip_heredoc
...
...
@@ -231,10 +246,10 @@ describe 'Copy as GFM', feature: true, js: true do
output_gfm
=
html_to_gfm
(
html
)
expect
(
output_gfm
.
strip
).
to
eq
(
gfm
.
strip
)
end
end
it
'supports SanitizationFilter'
do
verify
(
'SanitizationFilter'
,
<<-
GFM
.
strip_heredoc
<sub>sub</sub>
...
...
@@ -260,10 +275,10 @@ describe 'Copy as GFM', feature: true, js: true do
<abbr>abbr</abbr>
GFM
)
end
it
'supports SyntaxHighlightFilter'
do
verify
(
'SanitizationFilter'
,
<<-
GFM
.
strip_heredoc
,
```
Plain text
...
...
@@ -288,10 +303,10 @@ describe 'Copy as GFM', feature: true, js: true do
```
GFM
)
end
it
'supports MarkdownFilter'
do
verify
(
'MarkdownFilter'
,
"Line with two spaces at the end
\n
to insert a linebreak"
,
'`code`'
,
...
...
@@ -400,8 +415,8 @@ describe 'Copy as GFM', feature: true, js: true do
page
.
evaluate_script
(
js
)
end
def
verify
(
*
gfms
)
aggregate_failures
do
def
verify
(
label
,
*
gfms
)
aggregate_failures
(
label
)
do
gfms
.
each
do
|
gfm
|
html
=
gfm_to_html
(
gfm
)
output_gfm
=
html_to_gfm
(
html
)
...
...
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