1<?php
2
3require_once(__DIR__ . '/../webcomponent.php');
4
5/**
6 * Test the heading component plugin
7 *
8 * @group plugin_webcomponent
9 * @group plugins
10 */
11class plugin_webcomponent_heading_test extends DokuWikiTest
12{
13
14    protected $pluginsEnabled = [webcomponent::PLUGIN_NAME];
15
16
17    public function test_heading_character()
18    {
19
20        $componentName = syntax_plugin_webcomponent_heading::getHeadingCharacter();
21
22        $this->assertEquals('#', $componentName);
23
24    }
25
26    public function test_h1()
27    {
28
29        $doku_text = '====== Heading 1 ======'.DOKU_LF."Content";
30        $markdown_text = '# Heading 1'.DOKU_LF."Content";
31
32        $info = array();
33
34        $instructionsDoku = p_get_instructions($doku_text);
35        $instructionsMark = p_get_instructions($markdown_text);
36        $dokuXhtml = p_render('xhtml', $instructionsDoku, $info);
37        $markXhtml = p_render('xhtml', $instructionsMark, $info);
38        $this->assertEquals($dokuXhtml, $markXhtml);
39
40
41    }
42
43    public function test_h5()
44    {
45
46        $doku_text = '== Heading 5 =='.DOKU_LF."Content";
47        $markdown_text = '##### Heading 5'.DOKU_LF."Content";
48
49        $info = array();
50
51        $instructionsDoku = p_get_instructions($doku_text);
52        $instructionsMark = p_get_instructions($markdown_text);
53        $dokuXhtml = p_render('xhtml', $instructionsDoku, $info);
54        $markXhtml = p_render('xhtml', $instructionsMark, $info);
55        $this->assertEquals($dokuXhtml, $markXhtml);
56
57
58    }
59
60
61
62}
63