summaryrefslogtreecommitdiff
path: root/test/headers_test.rb
blob: ea6010232a216132ab2f0e0d6a3868d514b62c72 (plain) (blame)
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
require 'test_helper'

context "Headers" do
  test "main header" do
    assert_xpath "//h1", render_string("My Title\n=======")
  end

  context "level 1" do 
    test "with multiline syntax" do
      assert_xpath "//h2[@id='_my_section']", render_string("My Section\n-----------")
    end

    test "with single line syntax" do
      assert_xpath "//h2[@id='_my_title']", render_string("== My Title")
    end

    test "with non-word character" do
      assert_xpath "//h2[@id='_where_s_the_love']", render_string("== Where's the love?")
    end

    test "with sequential non-word characters" do
      assert_xpath "//h2[@id='_what_the_is_that']", render_string('== What the #@$ is that')
    end
  end

  context "level 2" do 
    test "with multiline syntax" do
      assert_xpath "//h3", render_string("My Section\n~~~~~~~~~~~")
    end

    test "with single line syntax" do
      assert_xpath "//h3", render_string("=== My Title")
    end
  end  

  context "level 3" do 
    test "with multiline syntax" do
      assert_xpath "//h4", render_string("My Section\n^^^^^^^^^^")
    end

    test "with single line syntax" do
      assert_xpath "//h4", render_string("==== My Title")
    end
  end

  context "level 4" do 
    test "with multiline syntax" do
      assert_xpath "//h5", render_string("My Section\n++++++++++")
    end

    test "with single line syntax" do
      assert_xpath "//h5", render_string("===== My Title")
    end
  end  
end