Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 85d211fa

Von Moritz Bunkus vor mehr als 8 Jahren hinzugefügt

  • ID 85d211face10cd47c2a0f3da25711c1471079e5c
  • Vorgänger 84f80318

Hilfesystem: Testcases für die kivitendo-spezifischen Features & Bugfixes

Unterschiede anzeigen:

t/help_system/fixes_and_additions.t
1
use Test::More;
2

  
3
use strict;
4

  
5
use lib 't';
6
use utf8;
7

  
8
use_ok 'SL::HelpSystem::MultiMarkdown';
9

  
10
sub untab {
11
  my $text = shift;
12
  $text    =~ s{\t}{  }g;
13
  return $text;
14
}
15

  
16
my $mmd = SL::HelpSystem::MultiMarkdown->new;
17

  
18
# Tables: put <col> into <colgroup>
19
is(untab($mmd->convert_content_to_html(qq{|This is|a table|
20
|-----|-----|
21
|With|content|})),
22
qq|<table>
23
<colgroup>
24
<col>
25
<col>
26
</colgroup>
27
<thead>
28
<tr>
29
  <th>This is</th>
30
  <th>a table</th>
31
</tr>
32
</thead>
33
<tbody>
34
<tr>
35
  <td>With</td>
36
  <td>content</td>
37
</tr>
38
</tbody>
39
</table>
40
|);
41

  
42
# Block comments with ``` … ```
43
is($mmd->convert_content_to_html(qq!```
44
This is a friggin' block quote.
45
## Even funky markup should stay just **that**.
46
Quote to the block.
47
```
48
!),
49
qq!<pre><code>This is a friggin' block quote.
50
## Even funky markup should stay just **that**.
51
Quote to the block.
52
</code></pre>
53
!);
54

  
55
# Attention blocks with == … ==
56
is($mmd->convert_content_to_html(qq{==**Attention!**
57

  
58
This is a public service announcement. Do not panic.
59
==}),
60
qq{<div class="attention"><p><strong>Attention!</strong></p>
61

  
62
<p>This is a public service announcement. Do not panic.</p></div>
63
});
64

  
65
# Intra-help system links
66
is($mmd->convert_content_to_html(qq{[Stay away from](help:da/voodoo#mon)}),
67
   qq{<p><a href="controller.pl?action=Help/show&context=da/voodoo#mon">Stay away from</a></p>\n});
68

  
69
# Convert line feeds to <br> tags
70
is($mmd->convert_content_to_html(qq{Please enforce
71
line breaks
72
here.}),
73
   qq{<p>Please enforce<br>\nline breaks<br>\nhere.</p>\n});
74

  
75
done_testing();

Auch abrufbar als: Unified diff