### ----------------------------------------------------
### -- HTML::Functional
### -- Licenses: Artistic-2.0
### -- Authors: librasteve
### -- File: t/02-body.rakutest
### ----------------------------------------------------
use Test;
use HTML::Functional;

#had to fine tune the stock symbol newline to make test work (editor trims trailing spaces)

my $body = body [
    div( :class<jumbotron>, [
        h1("Welcome to Dunder Mifflin!"),                          #use parens to stop <h1> slurping <p>
        p  "Dunder Mifflin Inc. (stock symbol{strong 'DMI'})\n" ~
            q:to/END/;
            is a micro-cap regional paper and office
            supply distributor with an emphasis on servicing
            small-business clients.
            END
    ]),

    p( :hx-get<https://v2.jokeapi.dev/joke/Any?format=txt&safe-mode>,
        "Click Me" ),

    p( ^'<div class="content">Escaped & Raw HTML!</div>' ),
];

my $expect =
    q:to/END/;

    <body>
    <div class="jumbotron">
    <h1>Welcome to Dunder Mifflin!</h1>
    <p>Dunder Mifflin Inc. (stock symbol
    <strong>DMI</strong>)
    is a micro-cap regional paper and office
    supply distributor with an emphasis on servicing
    small-business clients.
    </p>
    </div>
    <p hx-get="https://v2.jokeapi.dev/joke/Any?format=txt&safe-mode">Click Me</p>
    <p>&lt;div class=&quot;content&quot;&gt;Escaped &amp; Raw HTML!&lt;/div&gt;</p>
    </body>
    END

is $body, $expect.chomp, 'all-body';

done-testing;


