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
Kazuhiko Shiozaki
gitlab-ce
Commits
b41eb345
Commit
b41eb345
authored
Apr 13, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-arrange spec/helpers/gitlab_markdown_helper_spec a bit
parent
f76df890
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
111 additions
and
111 deletions
+111
-111
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+111
-111
No files found.
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
b41eb345
...
@@ -130,6 +130,116 @@ describe GitlabMarkdownHelper do
...
@@ -130,6 +130,116 @@ describe GitlabMarkdownHelper do
expect
(
gfm
(
":+1:"
)).
to
match
(
/<img/
)
expect
(
gfm
(
":+1:"
)).
to
match
(
/<img/
)
end
end
end
end
context
'parse_tasks: true'
do
before
(
:all
)
do
@source_text_asterisk
=
<<-
EOT
.
strip_heredoc
* [ ] valid unchecked task
* [x] valid lowercase checked task
* [X] valid uppercase checked task
* [ ] valid unchecked nested task
* [x] valid checked nested task
[ ] not an unchecked task - no list item
[x] not a checked task - no list item
* [ ] not an unchecked task - too many spaces
* [x ] not a checked task - too many spaces
* [] not an unchecked task - no spaces
* Not a task [ ] - not at beginning
EOT
@source_text_dash
=
<<-
EOT
.
strip_heredoc
- [ ] valid unchecked task
- [x] valid lowercase checked task
- [X] valid uppercase checked task
- [ ] valid unchecked nested task
- [x] valid checked nested task
EOT
end
it
'should render checkboxes at beginning of asterisk list items'
do
rendered_text
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid unchecked task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid lowercase checked task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid uppercase checked task/
)
end
it
'should render checkboxes at beginning of dash list items'
do
rendered_text
=
markdown
(
@source_text_dash
,
parse_tasks:
true
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid unchecked task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid lowercase checked task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid uppercase checked task/
)
end
it
'should render checkboxes for nested tasks'
do
rendered_text
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid unchecked nested task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid checked nested task/
)
end
it
'should not be confused by whitespace before bullets'
do
rendered_text_asterisk
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
rendered_text_dash
=
markdown
(
@source_text_dash
,
parse_tasks:
true
)
expect
(
rendered_text_asterisk
).
to
match
(
/<input.*checkbox.*valid unchecked nested task/
)
expect
(
rendered_text_asterisk
).
to
match
(
/<input.*checkbox.*valid checked nested task/
)
expect
(
rendered_text_dash
).
to
match
(
/<input.*checkbox.*valid unchecked nested task/
)
expect
(
rendered_text_dash
).
to
match
(
/<input.*checkbox.*valid checked nested task/
)
end
it
'should not render checkboxes outside of list items'
do
rendered_text
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not an unchecked task - no list item/
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not a checked task - no list item/
)
end
it
'should not render checkboxes with invalid formatting'
do
rendered_text
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not an unchecked task - too many spaces/
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not a checked task - too many spaces/
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not an unchecked task - no spaces/
)
expect
(
rendered_text
).
not_to
match
(
/Not a task.*<input.*checkbox.*not at beginning/
)
end
end
end
end
describe
"#link_to_gfm"
do
describe
"#link_to_gfm"
do
...
@@ -425,7 +535,7 @@ describe GitlabMarkdownHelper do
...
@@ -425,7 +535,7 @@ describe GitlabMarkdownHelper do
end
end
end
end
describe
"#render_wiki_content"
do
describe
'#render_wiki_content'
do
before
do
before
do
@wiki
=
double
(
'WikiPage'
)
@wiki
=
double
(
'WikiPage'
)
allow
(
@wiki
).
to
receive
(
:content
).
and_return
(
'wiki content'
)
allow
(
@wiki
).
to
receive
(
:content
).
and_return
(
'wiki content'
)
...
@@ -448,114 +558,4 @@ describe GitlabMarkdownHelper do
...
@@ -448,114 +558,4 @@ describe GitlabMarkdownHelper do
helper
.
render_wiki_content
(
@wiki
)
helper
.
render_wiki_content
(
@wiki
)
end
end
end
end
describe
'#gfm_with_tasks'
do
before
(
:all
)
do
@source_text_asterisk
=
<<
EOT
.
gsub
(
/^\s{8}/
,
''
)
* [ ] valid unchecked task
* [x] valid lowercase checked task
* [X] valid uppercase checked task
* [ ] valid unchecked nested task
* [x] valid checked nested task
[ ] not an unchecked task - no list item
[x] not a checked task - no list item
* [ ] not an unchecked task - too many spaces
* [x ] not a checked task - too many spaces
* [] not an unchecked task - no spaces
* Not a task [ ] - not at beginning
EOT
@source_text_dash
=
<<
EOT
.
gsub
(
/^\s{8}/
,
''
)
- [ ] valid unchecked task
- [x] valid lowercase checked task
- [X] valid uppercase checked task
- [ ] valid unchecked nested task
- [x] valid checked nested task
EOT
end
it
'should render checkboxes at beginning of asterisk list items'
do
rendered_text
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid unchecked task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid lowercase checked task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid uppercase checked task/
)
end
it
'should render checkboxes at beginning of dash list items'
do
rendered_text
=
markdown
(
@source_text_dash
,
parse_tasks:
true
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid unchecked task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid lowercase checked task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid uppercase checked task/
)
end
it
'should render checkboxes for nested tasks'
do
rendered_text
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid unchecked nested task/
)
expect
(
rendered_text
).
to
match
(
/<input.*checkbox.*valid checked nested task/
)
end
it
'should not be confused by whitespace before bullets'
do
rendered_text_asterisk
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
rendered_text_dash
=
markdown
(
@source_text_dash
,
parse_tasks:
true
)
expect
(
rendered_text_asterisk
).
to
match
(
/<input.*checkbox.*valid unchecked nested task/
)
expect
(
rendered_text_asterisk
).
to
match
(
/<input.*checkbox.*valid checked nested task/
)
expect
(
rendered_text_dash
).
to
match
(
/<input.*checkbox.*valid unchecked nested task/
)
expect
(
rendered_text_dash
).
to
match
(
/<input.*checkbox.*valid checked nested task/
)
end
it
'should not render checkboxes outside of list items'
do
rendered_text
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not an unchecked task - no list item/
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not a checked task - no list item/
)
end
it
'should not render checkboxes with invalid formatting'
do
rendered_text
=
markdown
(
@source_text_asterisk
,
parse_tasks:
true
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not an unchecked task - too many spaces/
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not a checked task - too many spaces/
)
expect
(
rendered_text
).
not_to
match
(
/<input.*checkbox.*not an unchecked task - no spaces/
)
expect
(
rendered_text
).
not_to
match
(
/Not a task.*<input.*checkbox.*not at beginning/
)
end
end
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