File: basic_pseudo.t

package info (click to toggle)
libcss-inliner-perl 4027-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 416 kB
  • sloc: perl: 882; makefile: 2
file content (57 lines) | stat: -rw-r--r-- 1,030 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
use strict;
use warnings;
use lib qw( ./lib ../lib );

use Test::More;
use Cwd;
use CSS::Inliner;

plan(tests => 3);

use_ok('CSS::Inliner');

local $SIG{__WARN__} = sub {
  my $message = shift;
  die $message; # map any warnings here to a fatal
};

my $html1 = <<END;
<html>
  <head>
    <title>Test Document</title>
    <style type="text/css">
      :focus { }
    </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 => $html1 });
my $inlined1 = $inliner->inlinify();

ok($inlined1, 'Leading whitespace psuedo rule processed correctly');

my $html2 = <<END;
<html>
  <head>
    <title>Test Document</title>
    <style type="text/css">:focus {}</style>
  </head>
  <body>
    <h1>Howdy!</h1>
    <h2>Let's Play</h2>
    <p>Got any games?</p>
  </body>
</html>
END

$inliner->read({ html => $html2 });
my $inlined2 = $inliner->inlinify();

ok($inlined2, 'No whitespace psuedo rule processed correctly');