-
Notifications
You must be signed in to change notification settings - Fork 525
/
Copy pathhtml5_test.rb
82 lines (68 loc) · 1.76 KB
/
html5_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
require 'test_helper'
class HTML5Test < Redcarpet::TestCase
def test_that_html5_works
section = <<-HTML.chomp.strip_heredoc
<section>
<p>The quick brown fox jumps over the lazy dog.</p>
</section>
HTML
figure = <<-HTML.chomp.strip_heredoc
<figure>
<img src="http://example.org/image.jpg" alt="">
<figcaption>
<p>Hello world!</p>
</figcaption>
</figure>
HTML
assert_renders section, section
assert_renders figure, figure
end
def test_that_html5_works_with_code_blocks
section = <<-HTML
\t<section>
\t\t<p>The quick brown fox jumps over the lazy dog.</p>
\t</section>
HTML
section_expected = <<-HTML.chomp.strip_heredoc
<pre><code><section>
<p>The quick brown fox jumps over the lazy dog.</p>
</section>
</code></pre>
HTML
header = <<-HTML
<header>
<hgroup>
<h1>Section heading</h1>
<h2>Subhead</h2>
</hgroup>
</header>
HTML
header_expected = <<-HTML.chomp.strip_heredoc
<pre><code><header>
<hgroup>
<h1>Section heading</h1>
<h2>Subhead</h2>
</hgroup>
</header>
</code></pre>
HTML
assert_renders section_expected, section
assert_renders header_expected, header
end
def test_script_tag_recognition
html = <<-HTML.chomp.strip_heredoc
<script type="text/javascript">
alert('Foo!');
</script>
HTML
assert_renders html, html
end
def test_new_html5_tags_not_escaped
details = <<-HTML.chomp.strip_heredoc
<details>
log:
</details>
HTML
assert_renders details, details
end
end