use strict;
local $^W = 1;
use Test::More 'no_plan';
use HTML::Element::Tiny;
sub _e {
return HTML::Element::Tiny->new(@_)
}
sub _h {
return _e(@_)->as_HTML;
}
$HTML::Element::Tiny::HAS_HTML_ENTITIES = 0;
is(
_h([ 'span' ]), qq{}, "basic tag",
);
is(
_h([ 'input' ]), qq{}, "basic closed tag",
);
is(
_h([ span => "foo" ]), qq{foo}, "text content",
);
is(
_h([ span => [ 'input' ] ]), qq{}, "element content",
);
is(
_h([ span => { id => "pie" }, "foo" ]), qq{foo},
"id and content",
);
is(
_h([ span => { class => "pie" }, "foo" ]), qq{foo},
"class and content",
);
is(
_h([ span => { class => "pie cake" }, "foo" ]),
qq{foo},
"classes and content",
);
is(
_h(qq{<'foo' & "bar">}), "<'foo' & "bar">",
"entity escaping: text segment"
);
is(
_e([ 'span' ])->attr({ class => "pie cake" })->as_HTML,
qq{},
"class by attr()",
);