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
|
use strict;
use warnings;
use lib qw( ./lib ../lib );
use Test::More;
use Cwd;
use CSS::Inliner;
plan(tests => 4);
use_ok('CSS::Inliner');
my $html = <<END;
<html>
<head>
<title>Test Document</title>
<style type="text/css">
h1 { color: red; font-size: 20px }
h2 { color: blue; font-size: 17px; }
</style>
</head>
<body>
<h1><>Howdy!<></h1>
<h2>"Let's Play"</h2>
<p>&&Got any games?&&</p>
</body>
</html>
END
my $inliner = CSS::Inliner->new();
$inliner->read({ html => $html });
my $inlined = $inliner->inlinify();
ok($inlined =~ m/<h1 style="color: red; font-size: 20px;"><>Howdy!<><\/h1>/, 'raw brackets present');
ok($inlined =~ m/<h2 style="color: blue; font-size: 17px;">"Let's Play"<\/h2>/, 'raw double quotes present, along with unescaped single quote');
ok($inlined =~ m/<p>&&Got any games\?&&<\/p>/, 'raw ampersands present');
|