Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test(gfm/table): add some test cases
  • Loading branch information
EmmetZC committed Nov 22, 2021
commit ed875bf2944ee97f62781a0e3030ec452d8d1bda
12 changes: 12 additions & 0 deletions test/specs/gfm/gfm.0.29.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@
"markdown": "| abc | def |\n| --- | --- |",
"example": 205
},
{
"section": "[extension] Tables",
"html": "<p>paragraph 1</p><table>\n<thead>\n<tr>\n<th>abc</th>\n<th>def</th>\n</tr>\n</thead>\n</table>",
"markdown": "paragraph 1\n| abc | def |\n| --- | --- |",
"example": 206
},
{
"section": "[extension] Tables",
"html": "<p>paragraph with <code>inline code</code></p><table>\n<thead>\n<tr>\n<th>abc</th>\n<th>def</th>\n</tr>\n</thead>\n</table>",
"markdown": "paragraph with `inline code`\n| abc | def |\n| --- | --- |",
"example": 207
},
{
"section": "[extension] Task list items",
"html": "<ul>\n<li><input disabled=\"\" type=\"checkbox\"> foo</li>\n<li><input checked=\"\" disabled=\"\" type=\"checkbox\"> bar</li>\n</ul>",
Expand Down
46 changes: 46 additions & 0 deletions test/unit/Lexer-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,52 @@ lheading 2
});
});

it('table after para', () => {
expectTokens({
md: `
paragraph 1
| a | b |
|---|---|
| 1 | 2 |
`,
tokens: [
{
type: 'paragraph',
raw: 'paragraph 1',
text: 'paragraph 1',
tokens: [{ type: 'text', raw: 'paragraph 1', text: 'paragraph 1' }]
},
{
type: 'table',
align: [null, null],
raw: '| a | b |\n|---|---|\n| 1 | 2 |\n',
header: [
{
text: 'a',
tokens: [{ type: 'text', raw: 'a', text: 'a' }]
},
{
text: 'b',
tokens: [{ type: 'text', raw: 'b', text: 'b' }]
}
],
rows: [
[
{
text: '1',
tokens: [{ type: 'text', raw: '1', text: '1' }]
},
{
text: '2',
tokens: [{ type: 'text', raw: '2', text: '2' }]
}
]
]
}
]
});
});

it('align table', () => {
expectTokens({
md: `
Expand Down