File: basic_redeclare.t

package info (click to toggle)
libcss-inliner-perl 4024-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 412 kB
  • sloc: perl: 882; makefile: 2
file content (50 lines) | stat: -rw-r--r-- 835 bytes parent folder | download
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
use strict;
use warnings;
use lib qw( ./lib ../lib );

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

plan(tests => 2);

use_ok('CSS::Inliner');

my $html = <<END;
<html>
 <head>
  <style type="text/css">
    .selector1 {
      color: #ff0000;
    }
    .selector2 {
      color: #1e00ff;
    }
    .selector1 {
      font-weight: bold;
    }
  </style>
 </head>
 <body>
  <div class="selector1 selector2" style="color: #1e00ff;font-weight: bold;">
    Example Text    
  </div>
 </body>
</html>
END

my $correct_result = <<'END';
<html>
 <head>
 </head>
 <body>
  <div style="color: #1e00ff; font-weight: bold;"> Example Text </div>
 </body>
</html>
END

my $inliner = CSS::Inliner->new({ strip_attrs => 1 });
$inliner->read({ html => $html });
my $inlined = $inliner->inlinify();

ok($inlined eq $correct_result, 'result was correct');