Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
749486ba
Commit
749486ba
authored
Oct 15, 2022
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update marked tests
parent
26aae0e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
38 deletions
+37
-38
marked.test.ts
web/src/labs/marked/marked.test.ts
+37
-38
No files found.
web/src/labs/marked/marked.test.ts
View file @
749486ba
...
...
@@ -3,44 +3,6 @@ import { unescape } from "lodash-es";
import
{
marked
}
from
"."
;
describe
(
"test marked parser"
,
()
=>
{
test
(
"test markdown table"
,
()
=>
{
const
tests
=
[
{
markdown
:
`text above the table
| a | b | c |
|---|---|---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
text below the table
`
,
want
:
`<p>text above the table</p>
<table>
<thead>
<tr>
<th>a</th><th>b</th><th>c</th>
</tr>
</thead>
<tbody>
<tr><td>1</td><td>2</td><td>3</td></tr><tr><td>4</td><td>5</td><td>6</td></tr>
</tbody>
</table>
<p>text below the table</p>
`
,
},
{
markdown
:
`| a | b | c |
| 1 | 2 | 3 |
| 4 | 5 | 6 |`
,
want
:
`<p>| a | b | c |</p>
<p>| 1 | 2 | 3 |</p>
<p>| 4 | 5 | 6 |</p>`
,
},
];
for
(
const
t
of
tests
)
{
expect
(
unescape
(
marked
(
t
.
markdown
))).
toBe
(
t
.
want
);
}
});
test
(
"parse code block"
,
()
=>
{
const
tests
=
[
{
...
...
@@ -159,4 +121,41 @@ console.log("hello world!")
expect
(
unescape
(
marked
(
t
.
markdown
))).
toBe
(
t
.
want
);
}
});
test
(
"parse table"
,
()
=>
{
const
tests
=
[
{
markdown
:
`text above the table
| a | b | c |
|---|---|---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
text below the table
`
,
want
:
`<p>text above the table</p>
<table>
<thead>
<tr>
<th>a</th><th>b</th><th>c</th>
</tr>
</thead>
<tbody>
<tr><td>1</td><td>2</td><td>3</td></tr><tr><td>4</td><td>5</td><td>6</td></tr>
</tbody>
</table>
<p>text below the table</p>
`
,
},
{
markdown
:
`| a | b | c |
| 1 | 2 | 3 |
| 4 | 5 | 6 |`
,
want
:
`<p>| a | b | c |</p>
<p>| 1 | 2 | 3 |</p>
<p>| 4 | 5 | 6 |</p>`
,
},
];
for
(
const
t
of
tests
)
{
expect
(
unescape
(
marked
(
t
.
markdown
))).
toBe
(
t
.
want
);
}
});
});
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