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
|
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 8;
use Test::TAP::Model::Visual;
my $m; BEGIN { use_ok($m = "Test::TAP::HTMLMatrix") };
my $s = Test::TAP::Model::Visual->new;
my $f = $s->start_file("foo");
eval { $f->{results} = $s->analyze("foo", [split /\n/, <<TAP]) };
1..6
ok 1 foo
not ok 2 bar
ok 3 gorch # skip foo
ok 4 # TODO bah
not ok 5 # TODO ding
Bail out!
TAP
isa_ok(my $t = $m->new($s, "blah"), $m);
my $inline_css_re = qr/border-collapse.*font-weight.*a:hover/s;
{
$t->has_inline_css(1);
my $html = $t->detail_html;
like($html, qr/<style/, "HTML contains style tag");
like($html, $inline_css_re, "document contains typical CSS string");
unlike($html, qr/htmlmatrix\.css/, "it doesn't mention the CSS file");
}
{
$t->has_inline_css(0);
my $html = $t->detail_html;
like($html, qr/<link.*?rel="stylesheet"/, "non inline css version contains link with rel=stylesheet");
unlike($html, $inline_css_re, "... but no inline css");
like($html, qr/htmlmatrix\.css/, "it mentions the CSS file");
}
|