test/devcenter-parser_test.rb in devcenter-parser-1.3.8 vs test/devcenter-parser_test.rb in devcenter-parser-1.3.9
- old
+ new
@@ -11,11 +11,11 @@
assert_parsing_unsanitized_result nil, :maruku, ''
end
it 'maintains script tags' do
md = '<script>alert("hi")</script>'
- assert_parsing_unsanitized_result md, :maruku, md
+ assert_parsing_unsanitized_result md, :maruku, '<script><![CDATA[alert("hi")]]></script>'
assert_parsing_unsanitized_result md, :github, '<script>alert("hi")</script>'
end
end
@@ -33,18 +33,20 @@
end
end
it 'respects existing ids' do
md = '<strong id="foo">clean</strong>'
- assert_maruku_result md, '<strong id="foo">clean</strong>'
- assert_github_result md, '<p><strong id="foo">clean</strong></p>'
+ html = '<p><strong id="foo">clean</strong></p>'
+ assert_maruku_result md, html
+ assert_github_result md, html
end
it 'removes script tags and their content' do
md = '<strong>clean<script>alert("hack!")</script></strong>'
- assert_maruku_result md, '<strong>clean</strong>'
- assert_github_result md, '<p><strong>clean</strong></p>'
+ html = '<p><strong>clean</strong></p>'
+ assert_maruku_result md, html
+ assert_github_result md, html
end
it 'includes ids in subheaders' do
md = <<-MARKDOWN
## Foo Bar Header 123
@@ -86,43 +88,59 @@
</div>
HTML
assert_github_result(md, html)
end
- it 'supports code blocks, adding a custom class attribute' do
+ it 'supports code blocks, respecting indentation and adding a custom class attribute' do
md = <<-MARKDOWN
Paragraph
- :::ruby
- puts 'hi'
+ :::term
+ $ command
+ indented
+ < tag1
+ > tag2
+
Another paragraph
MARKDOWN
html = <<-HTML
<p>Paragraph</p>
-<pre><code class="ruby">puts 'hi'</code></pre>
+<pre><code class="term">$ command
+ indented
+< tag1
+> tag2</code></pre>
+
<p>Another paragraph</p>
HTML
assert_maruku_result md, html
md = <<-MARKDOWN
Paragraph
-```ruby
-puts 'hi'
+```term
+$ command
+
+ indented
+< tag1
+> tag2
```
Another paragraph
MARKDOWN
html = <<-HTML
<p>Paragraph</p>
-<pre><code class="ruby">puts 'hi'
+<pre><code class="term">$ command
+
+ indented
+< tag1
+> tag2
</code></pre>
<p>Another paragraph</p>
HTML
assert_github_result md, html
@@ -343,11 +361,12 @@
end
end
it 'does not add href attribute to links where it does not exist' do
md = '<a name="heh"></a>'
- assert_maruku_result md, md
- assert_github_result md, "<p>#{md}</p>"
+ html = '<p><a name="heh"></a></p>'
+ assert_maruku_result md, html
+ assert_github_result md, html
end
it 'generates separate blockquotes from blockquotes separated by empty lines' do
md = <<-MARKDOWN
\ No newline at end of file