mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
Added testing suite
This commit is contained in:
parent
c37d77a31d
commit
d16e675ae8
|
@ -16,6 +16,10 @@
|
|||
"type": "git",
|
||||
"url": "https://github.com/coreyti/showdown.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"licenses": [{ "type": "BSD" }],
|
||||
"main": "./src/showdown"
|
||||
}
|
||||
|
|
5
test/cases/anchors-by-reference.html
Normal file
5
test/cases/anchors-by-reference.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
<p>This is <a href="http://example.com/" title="Optional Title Here">an example</a> reference-style link.
|
||||
This is <a href="http://example.com/" title="Optional Title Here">another</a> reference-style link.
|
||||
This is <a href="http://example.com/" title="Optional Title Here">a third</a> reference-style link.
|
||||
This is <a href="http://example.com/" title="Optional Title Here">a fourth</a> reference-style link.</p>
|
11
test/cases/anchors-by-reference.md
Normal file
11
test/cases/anchors-by-reference.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
This is [an example][id] reference-style link.
|
||||
This is [another] [foo] reference-style link.
|
||||
This is [a third][bar] reference-style link.
|
||||
This is [a fourth][4] reference-style link.
|
||||
|
||||
[id]: http://example.com/ "Optional Title Here"
|
||||
[foo]: http://example.com/ (Optional Title Here)
|
||||
[bar]: http://example.com/ (Optional Title Here)
|
||||
[4]: <http://example.com/>
|
||||
"Optional Title Here"
|
2
test/cases/automatic-anchors.html
Normal file
2
test/cases/automatic-anchors.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
<p><a href="http://example.com/">http://example.com/</a></p>
|
2
test/cases/automatic-anchors.md
Normal file
2
test/cases/automatic-anchors.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
<http://example.com/>
|
13
test/cases/blockquote-nested-markdown.html
Normal file
13
test/cases/blockquote-nested-markdown.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<blockquote>
|
||||
<h2 id="thisisaheader">This is a header.</h2>
|
||||
|
||||
<ol>
|
||||
<li>This is the first list item.</li>
|
||||
<li>This is the second list item.</li>
|
||||
</ol>
|
||||
|
||||
<p>Here's some example code:</p>
|
||||
|
||||
<pre><code>return shell_exec("echo $input | $markdown_script");
|
||||
</code></pre>
|
||||
</blockquote>
|
8
test/cases/blockquote-nested-markdown.md
Normal file
8
test/cases/blockquote-nested-markdown.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
> ## This is a header.
|
||||
>
|
||||
> 1. This is the first list item.
|
||||
> 2. This is the second list item.
|
||||
>
|
||||
> Here's some example code:
|
||||
>
|
||||
> return shell_exec("echo $input | $markdown_script");
|
5
test/cases/blockquote.html
Normal file
5
test/cases/blockquote.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<blockquote>
|
||||
<p>This is a multi line blockquote test</p>
|
||||
|
||||
<p>With more than one line.</p>
|
||||
</blockquote>
|
4
test/cases/blockquote.md
Normal file
4
test/cases/blockquote.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
> This is a multi line blockquote test
|
||||
>
|
||||
> With more than one line.
|
5
test/cases/code-block-html-escape.html
Normal file
5
test/cases/code-block-html-escape.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
<p>This is some HTML:</p>
|
||||
|
||||
<pre><code><h1>Heading</h1>
|
||||
</code></pre>
|
4
test/cases/code-block-html-escape.md
Normal file
4
test/cases/code-block-html-escape.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
This is some HTML:
|
||||
|
||||
<h1>Heading</h1>
|
5
test/cases/code-block.html
Normal file
5
test/cases/code-block.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
<p>This is a normal paragraph:</p>
|
||||
|
||||
<pre><code>This is a code block.
|
||||
</code></pre>
|
4
test/cases/code-block.md
Normal file
4
test/cases/code-block.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
This is a normal paragraph:
|
||||
|
||||
This is a code block.
|
5
test/cases/doubline-list.html
Normal file
5
test/cases/doubline-list.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
<ul>
|
||||
<li><p>Bird</p></li>
|
||||
<li><p>Magic</p></li>
|
||||
</ul>
|
4
test/cases/doubline-list.md
Normal file
4
test/cases/doubline-list.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
* Bird
|
||||
|
||||
* Magic
|
8
test/cases/emphasis.html
Normal file
8
test/cases/emphasis.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
<p><em>important</em></p>
|
||||
|
||||
<p><em>important</em></p>
|
||||
|
||||
<p>this mid<em>important</em>sentence</p>
|
||||
|
||||
<p>*not important*</p>
|
8
test/cases/emphasis.md
Normal file
8
test/cases/emphasis.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
*important*
|
||||
|
||||
_important_
|
||||
|
||||
this mid*important*sentence
|
||||
|
||||
\*not important\*
|
1
test/cases/escaped-number-period.html
Normal file
1
test/cases/escaped-number-period.html
Normal file
|
@ -0,0 +1 @@
|
|||
<p>It happened in 1986. What a great season.</p>
|
1
test/cases/escaped-number-period.md
Normal file
1
test/cases/escaped-number-period.md
Normal file
|
@ -0,0 +1 @@
|
|||
It happened in 1986\. What a great season.
|
32
test/cases/escaping.html
Normal file
32
test/cases/escaping.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
|
||||
<p>These should all be escaped:</p>
|
||||
|
||||
<p>\</p>
|
||||
|
||||
<p>`</p>
|
||||
|
||||
<p>*</p>
|
||||
|
||||
<p>_</p>
|
||||
|
||||
<p>{</p>
|
||||
|
||||
<p>}</p>
|
||||
|
||||
<p>[</p>
|
||||
|
||||
<p>]</p>
|
||||
|
||||
<p>(</p>
|
||||
|
||||
<p>)</p>
|
||||
|
||||
<p>#</p>
|
||||
|
||||
<p>+</p>
|
||||
|
||||
<p>-</p>
|
||||
|
||||
<p>.</p>
|
||||
|
||||
<p>!</p>
|
32
test/cases/escaping.md
Normal file
32
test/cases/escaping.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
|
||||
These should all be escaped:
|
||||
|
||||
\\
|
||||
|
||||
\`
|
||||
|
||||
\*
|
||||
|
||||
\_
|
||||
|
||||
\{
|
||||
|
||||
\}
|
||||
|
||||
\[
|
||||
|
||||
\]
|
||||
|
||||
\(
|
||||
|
||||
\)
|
||||
|
||||
\#
|
||||
|
||||
\+
|
||||
|
||||
\-
|
||||
|
||||
\.
|
||||
|
||||
\!
|
13
test/cases/github-style-codeblock.html
Normal file
13
test/cases/github-style-codeblock.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
|
||||
|
||||
<p>Define a function in javascript:</p>
|
||||
|
||||
<pre><code>function MyFunc(a) {
|
||||
// ...
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
And some HTML
|
||||
|
||||
<pre><code class="html"><div>HTML!</div>
|
||||
</code></pre>
|
14
test/cases/github-style-codeblock.md
Normal file
14
test/cases/github-style-codeblock.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
|
||||
Define a function in javascript:
|
||||
|
||||
```
|
||||
function MyFunc(a) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
And some HTML
|
||||
|
||||
```html
|
||||
<div>HTML!</div>
|
||||
```
|
1
test/cases/h1-with-double-hash.html
Normal file
1
test/cases/h1-with-double-hash.html
Normal file
|
@ -0,0 +1 @@
|
|||
<h1 id="thisisanh1">This is an H1</h1>
|
1
test/cases/h1-with-double-hash.md
Normal file
1
test/cases/h1-with-double-hash.md
Normal file
|
@ -0,0 +1 @@
|
|||
# This is an H1 #
|
1
test/cases/h1-with-equals.html
Normal file
1
test/cases/h1-with-equals.html
Normal file
|
@ -0,0 +1 @@
|
|||
<h1 id="thisisanh1">This is an H1</h1>
|
2
test/cases/h1-with-equals.md
Normal file
2
test/cases/h1-with-equals.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
This is an H1
|
||||
=============
|
1
test/cases/h1-with-single-hash.html
Normal file
1
test/cases/h1-with-single-hash.html
Normal file
|
@ -0,0 +1 @@
|
|||
<h1 id="thisisanh1">This is an H1</h1>
|
1
test/cases/h1-with-single-hash.md
Normal file
1
test/cases/h1-with-single-hash.md
Normal file
|
@ -0,0 +1 @@
|
|||
# This is an H1
|
1
test/cases/h2-with-dashes.html
Normal file
1
test/cases/h2-with-dashes.html
Normal file
|
@ -0,0 +1 @@
|
|||
<h2 id="thisisanh2">This is an H2</h2>
|
2
test/cases/h2-with-dashes.md
Normal file
2
test/cases/h2-with-dashes.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
This is an H2
|
||||
-------------
|
1
test/cases/h2-with-double-hash.html
Normal file
1
test/cases/h2-with-double-hash.html
Normal file
|
@ -0,0 +1 @@
|
|||
<h2 id="thisisanh2">This is an H2</h2>
|
1
test/cases/h2-with-double-hash.md
Normal file
1
test/cases/h2-with-double-hash.md
Normal file
|
@ -0,0 +1 @@
|
|||
## This is an H2 ##
|
1
test/cases/h2-with-single-hash.html
Normal file
1
test/cases/h2-with-single-hash.html
Normal file
|
@ -0,0 +1 @@
|
|||
<h2 id="thisisanh2">This is an H2</h2>
|
1
test/cases/h2-with-single-hash.md
Normal file
1
test/cases/h2-with-single-hash.md
Normal file
|
@ -0,0 +1 @@
|
|||
## This is an H2
|
1
test/cases/h3-with-double-hash.html
Normal file
1
test/cases/h3-with-double-hash.html
Normal file
|
@ -0,0 +1 @@
|
|||
<h3 id="thisisanh3">This is an H3</h3>
|
1
test/cases/h3-with-double-hash.md
Normal file
1
test/cases/h3-with-double-hash.md
Normal file
|
@ -0,0 +1 @@
|
|||
### This is an H3 ###
|
1
test/cases/h3-with-single-hash.html
Normal file
1
test/cases/h3-with-single-hash.html
Normal file
|
@ -0,0 +1 @@
|
|||
<h3 id="thisisanh3">This is an H3</h3>
|
1
test/cases/h3-with-single-hash.md
Normal file
1
test/cases/h3-with-single-hash.md
Normal file
|
@ -0,0 +1 @@
|
|||
### This is an H3
|
1
test/cases/h4-with-single-hash.html
Normal file
1
test/cases/h4-with-single-hash.html
Normal file
|
@ -0,0 +1 @@
|
|||
<h4 id="thisisanh4">This is an H4</h4>
|
1
test/cases/h4-with-single-hash.md
Normal file
1
test/cases/h4-with-single-hash.md
Normal file
|
@ -0,0 +1 @@
|
|||
#### This is an H4
|
1
test/cases/h5-with-single-hash.html
Normal file
1
test/cases/h5-with-single-hash.html
Normal file
|
@ -0,0 +1 @@
|
|||
<h5 id="thisisanh5">This is an H5</h5>
|
1
test/cases/h5-with-single-hash.md
Normal file
1
test/cases/h5-with-single-hash.md
Normal file
|
@ -0,0 +1 @@
|
|||
##### This is an H5
|
1
test/cases/h6-with-single-hash.html
Normal file
1
test/cases/h6-with-single-hash.html
Normal file
|
@ -0,0 +1 @@
|
|||
<h6 id="thisisanh6">This is an H6</h6>
|
1
test/cases/h6-with-single-hash.md
Normal file
1
test/cases/h6-with-single-hash.md
Normal file
|
@ -0,0 +1 @@
|
|||
###### This is an H6
|
10
test/cases/horizontal-rules.html
Normal file
10
test/cases/horizontal-rules.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
10
test/cases/horizontal-rules.md
Normal file
10
test/cases/horizontal-rules.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
* * *
|
||||
|
||||
***
|
||||
|
||||
*****
|
||||
|
||||
- - -
|
||||
|
||||
---------------------------------------
|
6
test/cases/images.html
Normal file
6
test/cases/images.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
<p><img src="/path/to/img.jpg" alt="Alt text" title="" /></p>
|
||||
|
||||
<p><img src="/path/to/img.jpg" alt="Alt text" title="Optional title" /></p>
|
||||
|
||||
<p><img src="url/to/image" alt="Alt text" title="Optional title attribute" /></p>
|
8
test/cases/images.md
Normal file
8
test/cases/images.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
![Alt text](/path/to/img.jpg)
|
||||
|
||||
![Alt text](/path/to/img.jpg "Optional title")
|
||||
|
||||
![Alt text][id]
|
||||
|
||||
[id]: url/to/image "Optional title attribute"
|
2
test/cases/implicit-anchors.html
Normal file
2
test/cases/implicit-anchors.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
<p>Search the web at <a href="http://google.com/">Google</a> or <a href="http://daringfireball.net/">Daring Fireball</a>.</p>
|
5
test/cases/implicit-anchors.md
Normal file
5
test/cases/implicit-anchors.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
Search the web at [Google][] or [Daring Fireball][].
|
||||
|
||||
[Google]: http://google.com/
|
||||
[Daring Fireball]: http://daringfireball.net/
|
4
test/cases/inline-anchors.html
Normal file
4
test/cases/inline-anchors.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
<p>This is <a href="http://example.com/" title="Title">an example</a> inline link.</p>
|
||||
|
||||
<p><a href="http://example.net/">This link</a> has no title attribute.</p>
|
4
test/cases/inline-anchors.md
Normal file
4
test/cases/inline-anchors.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
This is [an example](http://example.com/ "Title") inline link.
|
||||
|
||||
[This link](http://example.net/) has no title attribute.
|
12
test/cases/inline-code.html
Normal file
12
test/cases/inline-code.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
<p>Create a new <code>function</code>.</p>
|
||||
|
||||
<p>Use the backtick in MySQL syntax <code>SELECT `column` FROM whatever</code>.</p>
|
||||
|
||||
<p>A single backtick in a code span: <code>`</code></p>
|
||||
|
||||
<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
|
||||
|
||||
<p>Please don't use any <code><blink></code> tags.</p>
|
||||
|
||||
<p><code>&#8212;</code> is the decimal-encoded equivalent of <code>&mdash;</code>.</p>
|
12
test/cases/inline-code.md
Normal file
12
test/cases/inline-code.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
Create a new `function`.
|
||||
|
||||
Use the backtick in MySQL syntax ``SELECT `column` FROM whatever``.
|
||||
|
||||
A single backtick in a code span: `` ` ``
|
||||
|
||||
A backtick-delimited string in a code span: `` `foo` ``
|
||||
|
||||
Please don't use any `<blink>` tags.
|
||||
|
||||
`—` is the decimal-encoded equivalent of `—`.
|
5
test/cases/lazy-blockquote.html
Normal file
5
test/cases/lazy-blockquote.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<blockquote>
|
||||
<p>This is a multi line blockquote test</p>
|
||||
|
||||
<p>With more than one line.</p>
|
||||
</blockquote>
|
4
test/cases/lazy-blockquote.md
Normal file
4
test/cases/lazy-blockquote.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
> This is a multi line blockquote test
|
||||
|
||||
> With more than one line.
|
8
test/cases/list-with-blockquote.html
Normal file
8
test/cases/list-with-blockquote.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
<ul>
|
||||
<li><p>A list item with a blockquote:</p>
|
||||
|
||||
<blockquote>
|
||||
<p>This is a blockquote
|
||||
inside a list item.</p>
|
||||
</blockquote></li>
|
||||
</ul>
|
4
test/cases/list-with-blockquote.md
Normal file
4
test/cases/list-with-blockquote.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
* A list item with a blockquote:
|
||||
|
||||
> This is a blockquote
|
||||
> inside a list item.
|
6
test/cases/list-with-code.html
Normal file
6
test/cases/list-with-code.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
<ul>
|
||||
<li><p>A list item with code:</p>
|
||||
|
||||
<pre><code>alert('Hello world!');
|
||||
</code></pre></li>
|
||||
</ul>
|
3
test/cases/list-with-code.md
Normal file
3
test/cases/list-with-code.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
* A list item with code:
|
||||
|
||||
alert('Hello world!');
|
6
test/cases/multi-paragraph-list.html
Normal file
6
test/cases/multi-paragraph-list.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
<ol>
|
||||
<li><p>This is a major bullet point.</p>
|
||||
|
||||
<p>That contains multiple paragraphs.</p></li>
|
||||
<li><p>And another line</p></li>
|
||||
</ol>
|
6
test/cases/multi-paragraph-list.md
Normal file
6
test/cases/multi-paragraph-list.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
1. This is a major bullet point.
|
||||
|
||||
That contains multiple paragraphs.
|
||||
|
||||
2. And another line
|
5
test/cases/multiline-unordered-list.html
Normal file
5
test/cases/multiline-unordered-list.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<ul>
|
||||
<li>This line spans
|
||||
more than one line and is lazy</li>
|
||||
<li>Similar to this line</li>
|
||||
</ul>
|
4
test/cases/multiline-unordered-list.md
Normal file
4
test/cases/multiline-unordered-list.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
- This line spans
|
||||
more than one line and is lazy
|
||||
- Similar to this line
|
9
test/cases/nested-blockquote.html
Normal file
9
test/cases/nested-blockquote.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<blockquote>
|
||||
<p>This is a multi line blockquote test</p>
|
||||
|
||||
<blockquote>
|
||||
<p>And nesting!
|
||||
</blockquote>
|
||||
|
||||
<p>With more than one line.</p>
|
||||
</blockquote>
|
4
test/cases/nested-blockquote.md
Normal file
4
test/cases/nested-blockquote.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
> This is a multi line blockquote test
|
||||
> > And nesting!
|
||||
> With more than one line.
|
5
test/cases/ordered-list-same-number.html
Normal file
5
test/cases/ordered-list-same-number.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<ol>
|
||||
<li>Red</li>
|
||||
<li>Green</li>
|
||||
<li>Blue</li>
|
||||
</ol>
|
4
test/cases/ordered-list-same-number.md
Normal file
4
test/cases/ordered-list-same-number.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
1. Red
|
||||
1. Green
|
||||
1. Blue
|
5
test/cases/ordered-list-wrong-numbers.html
Normal file
5
test/cases/ordered-list-wrong-numbers.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<ol>
|
||||
<li>Red</li>
|
||||
<li>Green</li>
|
||||
<li>Blue</li>
|
||||
</ol>
|
4
test/cases/ordered-list-wrong-numbers.md
Normal file
4
test/cases/ordered-list-wrong-numbers.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
8. Red
|
||||
1. Green
|
||||
3. Blue
|
5
test/cases/ordered-list.html
Normal file
5
test/cases/ordered-list.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<ol>
|
||||
<li>Red</li>
|
||||
<li>Green</li>
|
||||
<li>Blue</li>
|
||||
</ol>
|
4
test/cases/ordered-list.md
Normal file
4
test/cases/ordered-list.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
1. Red
|
||||
2. Green
|
||||
3. Blue
|
2
test/cases/relative-anchors.html
Normal file
2
test/cases/relative-anchors.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
<p>See my <a href="/about/">About</a> page for details.</p>
|
2
test/cases/relative-anchors.md
Normal file
2
test/cases/relative-anchors.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
See my [About](/about/) page for details.
|
1
test/cases/simple-paragraph.html
Normal file
1
test/cases/simple-paragraph.html
Normal file
|
@ -0,0 +1 @@
|
|||
<p>Hello, world!</p>
|
2
test/cases/simple-paragraph.md
Normal file
2
test/cases/simple-paragraph.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
Hello, world!
|
6
test/cases/strong.html
Normal file
6
test/cases/strong.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
<p><strong>important</strong></p>
|
||||
|
||||
<p><strong>important</strong></p>
|
||||
|
||||
<p>really <strong>freaking</strong>strong</p>
|
6
test/cases/strong.md
Normal file
6
test/cases/strong.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
**important**
|
||||
|
||||
__important__
|
||||
|
||||
really **freaking**strong
|
5
test/cases/unordered-list-asterisk.html
Normal file
5
test/cases/unordered-list-asterisk.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<ul>
|
||||
<li>Red</li>
|
||||
<li>Green</li>
|
||||
<li>Blue</li>
|
||||
</ul>
|
4
test/cases/unordered-list-asterisk.md
Normal file
4
test/cases/unordered-list-asterisk.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
* Red
|
||||
* Green
|
||||
* Blue
|
5
test/cases/unordered-list-minus.html
Normal file
5
test/cases/unordered-list-minus.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<ul>
|
||||
<li>Red</li>
|
||||
<li>Green</li>
|
||||
<li>Blue</li>
|
||||
</ul>
|
4
test/cases/unordered-list-minus.md
Normal file
4
test/cases/unordered-list-minus.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
- Red
|
||||
- Green
|
||||
- Blue
|
5
test/cases/unordered-list-plus.html
Normal file
5
test/cases/unordered-list-plus.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<ul>
|
||||
<li>Red</li>
|
||||
<li>Green</li>
|
||||
<li>Blue</li>
|
||||
</ul>
|
4
test/cases/unordered-list-plus.md
Normal file
4
test/cases/unordered-list-plus.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
+ Red
|
||||
+ Green
|
||||
+ Blue
|
49
test/run.js
Normal file
49
test/run.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
|
||||
var showdown = new require('../src/showdown').Showdown,
|
||||
convertor = new showdown.converter(),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
should = require('should');
|
||||
|
||||
// Load test cases from disk
|
||||
var cases = fs.readdirSync('test/cases').filter(function(file){
|
||||
return ~file.indexOf('.md');
|
||||
}).map(function(file){
|
||||
return file.replace('.md', '');
|
||||
});
|
||||
|
||||
// Run each test case
|
||||
cases.forEach(function(test){
|
||||
var name = test.replace(/[-.]/g, ' ');
|
||||
it (name, function(){
|
||||
var mdpath = path.join('test/cases', test + '.md'),
|
||||
htmlpath = path.join('test/cases', test + '.html'),
|
||||
md = fs.readFileSync(mdpath, 'utf8'),
|
||||
expected = fs.readFileSync(htmlpath, 'utf8').trim(),
|
||||
actual = convertor.makeHtml(md).trim();
|
||||
|
||||
// Normalize line returns
|
||||
expected = expected.replace(/\r/g, '');
|
||||
|
||||
// Ignore all leading/trailing whitespace
|
||||
expected = expected.split('\n').map(function(x){
|
||||
return x.trim();
|
||||
}).join('\n');
|
||||
actual = actual.split('\n').map(function(x){
|
||||
return x.trim();
|
||||
}).join('\n');
|
||||
|
||||
// Convert whitespace to a visible character so that it shows up on error reports
|
||||
expected = expected.replace(/ /g, '·');
|
||||
expected = expected.replace(/\n/g, '•\n');
|
||||
actual = actual.replace(/ /g, '·');
|
||||
actual = actual.replace(/\n/g, '•\n');
|
||||
|
||||
if (test == 'github-style-codeblock') {
|
||||
console.log(actual);
|
||||
}
|
||||
|
||||
// Compare
|
||||
actual.should.equal(expected);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user