File: 25-flush-in-content.t

package info (click to toggle)
libhtml-mason-perl 1%3A1.58-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,796 kB
  • sloc: perl: 8,618; sh: 49; makefile: 2
file content (56 lines) | stat: -rw-r--r-- 1,141 bytes parent folder | download | duplicates (6)
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
use strict;
use warnings;

use File::Spec;
use HTML::Mason::Tests;

my $tests = make_tests();
$tests->run;

sub make_tests {
    my $group = HTML::Mason::Tests->tests_class->new(
        name        => 'flush-in-content',
        description => 'recursive calls with $m->content'
    );

    #------------------------------------------------------------

    $group->add_support(
        path      => '/widget',
        component => <<'EOF',
<div>\
<% $content |n %>\
</div>\
<%init>
my $content = $m->content;
</%init>
EOF
    );

    #------------------------------------------------------------

    $group->add_support(
        path      => '/block',
        component => <<'EOF',
<block></block>\
% $m->flush_buffer;
EOF
    );

    #------------------------------------------------------------

    $group->add_test(
        name => 'flush-in-deep-content',
        description =>
            'make sure flush does not flush when we are in $m->content()',
        component => <<'EOF',
<&| widget &><&| widget &><& block &></&></&>
EOF
        expect => <<'EOF',
<div><div><block></block></div></div>
EOF
    );

    return $group;
}