File: indent_internals.t

package info (click to toggle)
libhtml-formfu-perl 0.09007-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,184 kB
  • sloc: perl: 13,186; makefile: 9; sql: 5
file content (85 lines) | stat: -rw-r--r-- 1,994 bytes parent folder | download | duplicates (2)
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
83
84
85
use strict;
use warnings;

use Test::More tests => 1;

use HTML::FormFu;

my $form = HTML::FormFu->new;

my $proc = $form->output_processor( {
        type   => 'Indent',
        indent => " " x 4,
    } );

my $input = <<INPUT;
<form action="" method="post">
<fieldset>
<legend>Legend</legend>
<input name="hidden" type="hidden" value="1" />
<pre>
    foo bar
</pre>
<span class="text comment label">
<label for="text">Label</label>
<input name="text" type="text" />
<span class="comment">Comment</span>
</span>
<span class="textarea">
<textarea name="textarea" cols="40" rows="20">foo
bar
</textarea>
</span>
<span class="textarea">
<textarea name="empty_textarea" cols="40" rows="20"></textarea>
</span>
<span class="select">
<select name="select">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</span>
<span class="submit">
<input name="submit" type="submit" />
</span>
</fieldset>
</form>
INPUT

my $output = <<OUTPUT;
<form action="" method="post">
    <fieldset>
        <legend>Legend</legend>
        <input name="hidden" type="hidden" value="1" />
        <pre>
    foo bar
</pre>
        <span class="text comment label">
            <label for="text">Label</label>
            <input name="text" type="text" />
            <span class="comment">Comment</span>
        </span>
        <span class="textarea">
            <textarea name="textarea" cols="40" rows="20">foo
bar
</textarea>
        </span>
        <span class="textarea">
            <textarea name="empty_textarea" cols="40" rows="20"></textarea>
        </span>
        <span class="select">
            <select name="select">
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
            </select>
        </span>
        <span class="submit">
            <input name="submit" type="submit" />
        </span>
    </fieldset>
</form>
OUTPUT

is( $proc->process($input), $output );