/[Frey]/trunk/t/02-Frey-Web.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/t/02-Frey-Web.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 121 by dpavlin, Mon Jul 14 21:22:43 2008 UTC revision 546 by dpavlin, Wed Nov 26 20:48:07 2008 UTC
# Line 2  Line 2 
2  use strict;  use strict;
3  use warnings;  use warnings;
4    
5  use Test::More tests => 12;  use Test::More tests => 27;
6  use lib 'lib';  use lib 'lib';
7    
8  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
9    
10  my $debug = 1 if @ARGV;  my $debug = @ARGV ? 0 : 1;
11    
12  BEGIN {  BEGIN {
13          use_ok('Frey::Web');          use_ok('Frey::Web');
# Line 25  BEGIN { Line 25  BEGIN {
25  isa_ok( Frey::Web->meta, 'Moose::Meta::Role' );  isa_ok( Frey::Web->meta, 'Moose::Meta::Role' );
26    
27    
28  ok( my $o = Mock->new( debug => $debug ), 'new' );  ok( my $o = Mock->new( debug => $debug, inline_smaller_than => 1 ), '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_head( '/static/lib/Joose.js' ), 'add_head js' );
32    
33  ok( my @js = $o->javascript, 'javascript' );  ok( my @head = $o->head, 'js' );
34    
35  diag dump( @js ) if $debug;  diag dump( @head ) if $debug;
36    
37  ok( $o->add_css( '/static/introspect.css' ), 'add_css' );  ok( $o->add_head( '/static/introspect.css' ),  'add_head css' );
38    ok( $o->add_head( "<!--\nhead comment\n-->" ), 'add_head comment' );
39    ok( $o->add_head( "<span>head html</span>>" ), 'add_head html' );
40    
41  ok( my $html = $o->page( title => 'Test', body => '<!-- in-body -->' ), 'page' );  ok( my $html = $o->page( title => 'Test', body => '<!-- in-body -->' ), 'page' );
42  diag $html if $debug;  diag $html if $debug;
43    
44  like( $html, qr{text/javascript.*\.js}, 'have js' );  like( $html, qr{text/javascript.*\.js}, 'have js' );
45  like( $html, qr{text/css.*\.css}, 'have css' );  like( $html, qr{text/css.*\.css}, 'have css' );
46    like( $html, qr{head comment}, 'have comment' );
47    like( $html, qr{head html}, 'have html' );
48    like( $html, qr{icon}, 'have icon' );
49    
50  html_ok( $html, 'html lint' );  html_ok( $html, 'html lint' );
51    
52    ok( my $s = $o->add_head( 'static/frey.css' ), 'add_head css' );
53    diag $s if $debug;
54    ok( $s = $o->add_head( 'static/js/ext-2.1/ext-all.js' ), 'add_head js' );
55    diag $s if $debug;
56    
57    ok( $o->title, 'has title' );
58    
59    ok( my $html2 = $o->page( title => 'Test2', body => '<!-- in-body 2 -->' ), 'page' );
60    diag $html2 if $debug;
61    
62    cmp_ok( length( $html ), '<', length( $html2 ), 'bigger html' );
63    
64    like( $html2, qr{frey\.css}, 'have css' );
65    like( $html2, qr{ext}, 'have js' );
66    
67    ok( my $error = $o->error('test,ignore'), 'error' );
68    diag $error if $debug;
69    like( $error, qr{test,ignore.*$0}s, "have $0" );
70    
71    ok( $o->dump_max_bytes, 'dump_max_bytes' );

Legend:
Removed from v.121  
changed lines
  Added in v.546

  ViewVC Help
Powered by ViewVC 1.1.26