/[Frey]/branches/zimbardo/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

Annotation of /branches/zimbardo/t/02-Frey-Web.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 546 - (hide annotations)
Wed Nov 26 20:48:07 2008 UTC (15 years, 5 months ago) by dpavlin
Original Path: trunk/t/02-frey-web.t
File MIME type: application/x-troff
File size: 1776 byte(s)
better html detection, cleanup code and move around in class
1 dpavlin 100 #!/usr/bin/perl
2     use strict;
3     use warnings;
4    
5 dpavlin 546 use Test::More tests => 27;
6 dpavlin 100 use lib 'lib';
7    
8 dpavlin 121 use Data::Dump qw/dump/;
9    
10 dpavlin 532 my $debug = @ARGV ? 0 : 1;
11 dpavlin 121
12 dpavlin 100 BEGIN {
13     use_ok('Frey::Web');
14 dpavlin 121 use_ok('Frey');
15     use_ok('Test::HTML::Lint');
16 dpavlin 100 }
17    
18 dpavlin 121 {
19     package Mock;
20     use Moose;
21     extends 'Frey';
22     with 'Frey::Web';
23     }
24    
25 dpavlin 100 isa_ok( Frey::Web->meta, 'Moose::Meta::Role' );
26    
27 dpavlin 121
28 dpavlin 161 ok( my $o = Mock->new( debug => $debug, inline_smaller_than => 1 ), 'new' );
29 dpavlin 121 diag $o->dump(2) if $debug;
30    
31 dpavlin 156 ok( $o->add_head( '/static/lib/Joose.js' ), 'add_head js' );
32 dpavlin 121
33 dpavlin 156 ok( my @head = $o->head, 'js' );
34 dpavlin 121
35 dpavlin 156 diag dump( @head ) if $debug;
36 dpavlin 121
37 dpavlin 546 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 dpavlin 121
41     ok( my $html = $o->page( title => 'Test', body => '<!-- in-body -->' ), 'page' );
42     diag $html if $debug;
43    
44     like( $html, qr{text/javascript.*\.js}, 'have js' );
45     like( $html, qr{text/css.*\.css}, 'have css' );
46 dpavlin 546 like( $html, qr{head comment}, 'have comment' );
47 dpavlin 444 like( $html, qr{head html}, 'have html' );
48 dpavlin 527 like( $html, qr{icon}, 'have icon' );
49 dpavlin 121
50     html_ok( $html, 'html lint' );
51 dpavlin 154
52 dpavlin 156 ok( my $s = $o->add_head( 'static/frey.css' ), 'add_head css' );
53 dpavlin 154 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 dpavlin 418 ok( $o->title, 'has title' );
58    
59 dpavlin 154 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 dpavlin 156 like( $html2, qr{frey\.css}, 'have css' );
65 dpavlin 154 like( $html2, qr{ext}, 'have js' );
66 dpavlin 460
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 dpavlin 476 ok( $o->dump_max_bytes, 'dump_max_bytes' );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26