2 |
use strict; |
use strict; |
3 |
use warnings; |
use warnings; |
4 |
|
|
5 |
use Test::More tests => 12; |
use Test::More tests => 18; |
6 |
use lib 'lib'; |
use lib 'lib'; |
7 |
|
|
8 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
28 |
ok( my $o = Mock->new( debug => $debug ), 'new' ); |
ok( my $o = Mock->new( debug => $debug ), 'new' ); |
29 |
diag $o->dump(2) if $debug; |
diag $o->dump(2) if $debug; |
30 |
|
|
31 |
ok( $o->add_javascript( '/static/lib/Joose.js' ), 'add_javascript' ); |
ok( $o->add_js( '/static/lib/Joose.js' ), 'add_js' ); |
32 |
|
|
33 |
ok( my @js = $o->javascript, 'javascript' ); |
ok( my @js = $o->js, 'js' ); |
34 |
|
|
35 |
diag dump( @js ) if $debug; |
diag dump( @js ) if $debug; |
36 |
|
|
43 |
like( $html, qr{text/css.*\.css}, 'have css' ); |
like( $html, qr{text/css.*\.css}, 'have css' ); |
44 |
|
|
45 |
html_ok( $html, 'html lint' ); |
html_ok( $html, 'html lint' ); |
46 |
|
|
47 |
|
ok( my $s = $o->add_head( 'static/app.css' ), 'add_head css' ); |
48 |
|
diag $s if $debug; |
49 |
|
ok( $s = $o->add_head( 'static/js/ext-2.1/ext-all.js' ), 'add_head js' ); |
50 |
|
diag $s if $debug; |
51 |
|
|
52 |
|
ok( my $html2 = $o->page( title => 'Test2', body => '<!-- in-body 2 -->' ), 'page' ); |
53 |
|
diag $html2 if $debug; |
54 |
|
|
55 |
|
cmp_ok( length( $html ), '<', length( $html2 ), 'bigger html' ); |
56 |
|
|
57 |
|
like( $html2, qr{app\.css}, 'have css' ); |
58 |
|
like( $html2, qr{ext}, 'have js' ); |