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
Léo-Paul Géneau
gitlab-ce
Commits
3cafa743
Commit
3cafa743
authored
Jul 20, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use aggregate_failures where appropriate
parent
06478ef3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
34 deletions
+53
-34
spec/features/markdown_spec.rb
spec/features/markdown_spec.rb
+53
-34
No files found.
spec/features/markdown_spec.rb
View file @
3cafa743
...
@@ -81,10 +81,13 @@ describe 'GitLab Markdown', feature: true do
...
@@ -81,10 +81,13 @@ describe 'GitLab Markdown', feature: true do
describe
'Tables'
do
describe
'Tables'
do
it
'parses table Markdown'
do
it
'parses table Markdown'
do
body
=
get_section
(
'tables'
)
body
=
get_section
(
'tables'
)
aggregate_failures
do
expect
(
body
).
to
have_selector
(
'th:contains("Header")'
)
expect
(
body
).
to
have_selector
(
'th:contains("Header")'
)
expect
(
body
).
to
have_selector
(
'th:contains("Row")'
)
expect
(
body
).
to
have_selector
(
'th:contains("Row")'
)
expect
(
body
).
to
have_selector
(
'th:contains("Example")'
)
expect
(
body
).
to
have_selector
(
'th:contains("Example")'
)
end
end
end
it
'allows Markdown in tables'
do
it
'allows Markdown in tables'
do
expect
(
doc
.
at_css
(
'td:contains("Baz")'
).
children
.
to_html
).
expect
(
doc
.
at_css
(
'td:contains("Baz")'
).
children
.
to_html
).
...
@@ -94,10 +97,12 @@ describe 'GitLab Markdown', feature: true do
...
@@ -94,10 +97,12 @@ describe 'GitLab Markdown', feature: true do
describe
'Fenced Code Blocks'
do
describe
'Fenced Code Blocks'
do
it
'parses fenced code blocks'
do
it
'parses fenced code blocks'
do
aggregate_failures
do
expect
(
doc
).
to
have_selector
(
'pre.code.highlight.white.c'
)
expect
(
doc
).
to
have_selector
(
'pre.code.highlight.white.c'
)
expect
(
doc
).
to
have_selector
(
'pre.code.highlight.white.python'
)
expect
(
doc
).
to
have_selector
(
'pre.code.highlight.white.python'
)
end
end
end
end
end
describe
'Strikethrough'
do
describe
'Strikethrough'
do
it
'parses strikethroughs'
do
it
'parses strikethroughs'
do
...
@@ -108,15 +113,19 @@ describe 'GitLab Markdown', feature: true do
...
@@ -108,15 +113,19 @@ describe 'GitLab Markdown', feature: true do
describe
'Superscript'
do
describe
'Superscript'
do
it
'parses superscript'
do
it
'parses superscript'
do
body
=
get_section
(
'superscript'
)
body
=
get_section
(
'superscript'
)
aggregate_failures
do
expect
(
body
.
to_html
).
to
match
(
'1<sup>st</sup>'
)
expect
(
body
.
to_html
).
to
match
(
'1<sup>st</sup>'
)
expect
(
body
.
to_html
).
to
match
(
'2<sup>nd</sup>'
)
expect
(
body
.
to_html
).
to
match
(
'2<sup>nd</sup>'
)
end
end
end
end
end
end
end
describe
'HTML::Pipeline'
do
describe
'HTML::Pipeline'
do
describe
'SanitizationFilter'
do
describe
'SanitizationFilter'
do
it
'uses a permissive whitelist'
do
it
'uses a permissive whitelist'
do
aggregate_failures
do
expect
(
doc
).
to
have_selector
(
'b:contains("b tag")'
)
expect
(
doc
).
to
have_selector
(
'b:contains("b tag")'
)
expect
(
doc
).
to
have_selector
(
'em:contains("em tag")'
)
expect
(
doc
).
to
have_selector
(
'em:contains("em tag")'
)
expect
(
doc
).
to
have_selector
(
'code:contains("code tag")'
)
expect
(
doc
).
to
have_selector
(
'code:contains("code tag")'
)
...
@@ -126,12 +135,14 @@ describe 'GitLab Markdown', feature: true do
...
@@ -126,12 +135,14 @@ describe 'GitLab Markdown', feature: true do
expect
(
doc
).
to
have_selector
(
'br'
)
expect
(
doc
).
to
have_selector
(
'br'
)
expect
(
doc
).
to
have_selector
(
'hr'
)
expect
(
doc
).
to
have_selector
(
'hr'
)
end
end
end
it
'permits span elements'
do
it
'permits span elements'
do
expect
(
doc
).
to
have_selector
(
'span:contains("span tag")'
)
expect
(
doc
).
to
have_selector
(
'span:contains("span tag")'
)
end
end
it
'permits table alignment'
do
it
'permits table alignment'
do
aggregate_failures
do
expect
(
doc
.
at_css
(
'th:contains("Header")'
)[
'style'
]).
to
eq
'text-align: center'
expect
(
doc
.
at_css
(
'th:contains("Header")'
)[
'style'
]).
to
eq
'text-align: center'
expect
(
doc
.
at_css
(
'th:contains("Row")'
)[
'style'
]).
to
eq
'text-align: right'
expect
(
doc
.
at_css
(
'th:contains("Row")'
)[
'style'
]).
to
eq
'text-align: right'
expect
(
doc
.
at_css
(
'th:contains("Example")'
)[
'style'
]).
to
eq
'text-align: left'
expect
(
doc
.
at_css
(
'th:contains("Example")'
)[
'style'
]).
to
eq
'text-align: left'
...
@@ -140,6 +151,7 @@ describe 'GitLab Markdown', feature: true do
...
@@ -140,6 +151,7 @@ describe 'GitLab Markdown', feature: true do
expect
(
doc
.
at_css
(
'td:contains("Bar")'
)[
'style'
]).
to
eq
'text-align: right'
expect
(
doc
.
at_css
(
'td:contains("Bar")'
)[
'style'
]).
to
eq
'text-align: right'
expect
(
doc
.
at_css
(
'td:contains("Baz")'
)[
'style'
]).
to
eq
'text-align: left'
expect
(
doc
.
at_css
(
'td:contains("Baz")'
)[
'style'
]).
to
eq
'text-align: left'
end
end
end
it
'removes `rel` attribute from links'
do
it
'removes `rel` attribute from links'
do
body
=
get_section
(
'sanitizationfilter'
)
body
=
get_section
(
'sanitizationfilter'
)
...
@@ -161,6 +173,7 @@ describe 'GitLab Markdown', feature: true do
...
@@ -161,6 +173,7 @@ describe 'GitLab Markdown', feature: true do
describe
'Edge Cases'
do
describe
'Edge Cases'
do
it
'allows markup inside link elements'
do
it
'allows markup inside link elements'
do
aggregate_failures
do
expect
(
doc
.
at_css
(
'a[href="#link-emphasis"]'
).
to_html
).
expect
(
doc
.
at_css
(
'a[href="#link-emphasis"]'
).
to_html
).
to
eq
%{<a href="#link-emphasis"><em>text</em></a>}
to
eq
%{<a href="#link-emphasis"><em>text</em></a>}
...
@@ -171,6 +184,7 @@ describe 'GitLab Markdown', feature: true do
...
@@ -171,6 +184,7 @@ describe 'GitLab Markdown', feature: true do
to
eq
%{<a href="#link-code"><code>text</code></a>}
to
eq
%{<a href="#link-code"><code>text</code></a>}
end
end
end
end
end
describe
'EmojiFilter'
do
describe
'EmojiFilter'
do
it
'parses Emoji'
do
it
'parses Emoji'
do
...
@@ -180,11 +194,13 @@ describe 'GitLab Markdown', feature: true do
...
@@ -180,11 +194,13 @@ describe 'GitLab Markdown', feature: true do
describe
'TableOfContentsFilter'
do
describe
'TableOfContentsFilter'
do
it
'creates anchors inside header elements'
do
it
'creates anchors inside header elements'
do
aggregate_failures
do
expect
(
doc
).
to
have_selector
(
'h1 a#gitlab-markdown'
)
expect
(
doc
).
to
have_selector
(
'h1 a#gitlab-markdown'
)
expect
(
doc
).
to
have_selector
(
'h2 a#markdown'
)
expect
(
doc
).
to
have_selector
(
'h2 a#markdown'
)
expect
(
doc
).
to
have_selector
(
'h3 a#autolinkfilter'
)
expect
(
doc
).
to
have_selector
(
'h3 a#autolinkfilter'
)
end
end
end
end
end
describe
'AutolinkFilter'
do
describe
'AutolinkFilter'
do
def
body
def
body
...
@@ -290,12 +306,15 @@ describe 'GitLab Markdown', feature: true do
...
@@ -290,12 +306,15 @@ describe 'GitLab Markdown', feature: true do
describe
'Task Lists'
do
describe
'Task Lists'
do
it
'generates task lists'
do
it
'generates task lists'
do
body
=
get_section
(
'task-lists'
)
body
=
get_section
(
'task-lists'
)
aggregate_failures
do
expect
(
body
).
to
have_selector
(
'ul.task-list'
,
count:
2
)
expect
(
body
).
to
have_selector
(
'ul.task-list'
,
count:
2
)
expect
(
body
).
to
have_selector
(
'li.task-list-item'
,
count:
7
)
expect
(
body
).
to
have_selector
(
'li.task-list-item'
,
count:
7
)
expect
(
body
).
to
have_selector
(
'input[checked]'
,
count:
3
)
expect
(
body
).
to
have_selector
(
'input[checked]'
,
count:
3
)
end
end
end
end
end
end
end
# `markdown` calls these two methods
# `markdown` calls these two methods
def
current_user
def
current_user
...
...
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