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
2df781b0
Commit
2df781b0
authored
Jul 20, 2020
by
Enrique Alcantara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement HTML to Markdown integration tests
parent
b4b27440
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
spec/frontend/vue_shared/components/rich_content_editor/rich_content_editor_integration_spec.js
...ch_content_editor/rich_content_editor_integration_spec.js
+54
-0
No files found.
spec/frontend/vue_shared/components/rich_content_editor/rich_content_editor_integration_spec.js
0 → 100644
View file @
2df781b0
import
Editor
from
'
@toast-ui/editor
'
;
import
{
registerHTMLToMarkdownRenderer
}
from
'
~/vue_shared/components/rich_content_editor/services/editor_service
'
;
import
'
@toast-ui/editor/dist/toastui-editor.css
'
;
describe
(
'
vue_shared/components/rich_content_editor
'
,
()
=>
{
let
editor
;
const
buildEditor
=
()
=>
{
editor
=
new
Editor
({
el
:
document
.
body
,
});
registerHTMLToMarkdownRenderer
(
editor
);
};
beforeEach
(()
=>
{
buildEditor
();
});
describe
(
'
HTML to Markdown
'
,
()
=>
{
it
(
'
uses "-" character list marker in unordered lists
'
,
()
=>
{
editor
.
setHtml
(
'
<ul><li>List item 1</li><li>List item 2</li></ul>
'
);
const
markdown
=
editor
.
getMarkdown
();
expect
(
markdown
).
toBe
(
'
- List item 1
\n
- List item 2
'
);
});
it
(
'
does not increment the list marker in ordered lists
'
,
()
=>
{
editor
.
setHtml
(
'
<ol><li>List item 1</li><li>List item 2</li></ol>
'
);
const
markdown
=
editor
.
getMarkdown
();
expect
(
markdown
).
toBe
(
'
1. List item 1
\n
1. List item 2
'
);
});
it
(
'
indents lists using four spaces
'
,
()
=>
{
editor
.
setHtml
(
'
<ul><li>List item 1</li><ul><li>List item 2</li></ul></ul>
'
);
const
markdown
=
editor
.
getMarkdown
();
expect
(
markdown
).
toBe
(
'
- List item 1
\n
- List item 2
'
);
});
it
(
'
uses * for strong and _ for emphasis text
'
,
()
=>
{
editor
.
setHtml
(
'
<strong>strong text</strong><i>emphasis text</i>
'
);
const
markdown
=
editor
.
getMarkdown
();
expect
(
markdown
).
toBe
(
'
**strong text**_emphasis text_
'
);
});
});
});
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