File: comment_test.rb

package info (click to toggle)
ruby-hamlit 2.11.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,360 kB
  • sloc: ruby: 10,707; ansic: 552; sh: 23; makefile: 8
file content (75 lines) | stat: -rw-r--r-- 1,542 bytes parent folder | download | duplicates (4)
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
describe Hamlit::Engine do
  include RenderHelper

  describe 'comment' do
    it 'renders html comment' do
      assert_render(%Q|<!-- comments -->\n|, '/ comments')
    end

    it 'strips html comment ignoring around spcaes' do
      assert_render(%Q|<!-- comments -->\n|, '/   comments    ')
    end

    it 'accepts backslash-only line in a comment' do
      assert_render(<<-HTML.unindent, <<-'HAML'.unindent)
        <!--

        -->
      HTML
        /
          \
      HAML
    end

    it 'renders a deeply indented comment starting with backslash' do
      assert_render(<<-HTML.unindent, <<-'HAML'.unindent)
        <!--
               a
        -->
        <!--
        a
        -->
      HTML
        /
          \       a
        /
          a
      HAML
    end

    it 'ignores multiline comment' do
      assert_render(<<-HTML.unindent, <<-'HAML'.unindent)
        ok
      HTML
        -# if true
          - raise 'ng'
            = invalid script
                too deep indent
        ok
      HAML
    end

    it 'renders conditional comment' do
      assert_render(<<-HTML.unindent, <<-'HAML'.unindent)
        <!--[[if IE]]>
        <span>hello</span>
        world
        <![endif]-->
      HTML
        /[[if IE]]
          %span hello
          world
      HAML
    end
    it 'renders conditional comment' do
      assert_render(<<-HTML.unindent, <<-'HAML'.unindent)
        <!--[if lt IE 9]>
        hello
        <![endif]-->
      HTML
        /[if lt IE 9]
          hello
      HAML
    end
  end
end