4 use RT::Test tests => 26;
6 RT->Config->Set( DevelMode => 0 );
7 RT->Config->Set( WebDefaultStylesheet => 'aileron' );
8 RT->Config->Set( MasonLocalComponentRoot => RT::Test::get_abs_relocatable_dir('html') );
10 my ( $url, $m ) = RT::Test->started_ok;
13 diag "test squished files with devel mode disabled";
15 $m->follow_link_ok( { url_regex => qr!aileron-squished-([a-f0-9]{32})\.css! },
16 'follow squished css' );
17 $m->content_like( qr!/\*\* End of .*?.css \*/!, 'squished css' );
18 $m->content_lacks( 'text-decoration: underline !important;',
19 'no print.css by default' );
23 $m->content =~ m!src="([^"]+?squished-([a-f0-9]{32})\.js)"!;
24 $m->get_ok( $url . $js_link, 'follow squished js' );
25 $m->content_lacks('function just_testing', "no not-by-default.js");
26 $m->content_contains('jQuery.noConflict', "found default js content");
28 RT::Test->stop_server;
30 diag "test squished files with customized files and devel mode disabled";
31 RT->AddJavaScript( 'not-by-default.js' );
32 RT->AddStyleSheets( 'print.css' );
34 ( $url, $m ) = RT::Test->started_ok;
37 $m->follow_link_ok( { url_regex => qr!aileron-squished-([a-f0-9]{32})\.css! },
38 'follow squished css' );
39 $m->content_like( qr!/\*\* End of .*?.css \*/!, 'squished css' );
40 $m->content_contains( 'text-decoration: underline !important;',
45 $m->content =~ m!src="([^"]+?squished-([a-f0-9]{32})\.js)"!;
46 $m->get_ok( $url . $js_link, 'follow squished js' );
47 $m->content_contains( 'function just_testing', "has not-by-default.js" );
48 $m->content_contains('jQuery.noConflict', "found default js content");
49 RT::Test->stop_server;
52 diag "Test with a trivial jsmin which is a pass-through";
53 RT->Config->Set( 'JSMinPath' => RT::Test::get_abs_relocatable_dir("passthrough-jsmin"));
54 ( $url, $m ) = RT::Test->started_ok;
57 $m->content =~ m!src="([^"]+?squished-([a-f0-9]{32})\.js)"!;
58 $m->get_ok( $url . $js_link, 'follow squished js' );
59 $m->content_contains( 'passthrough-jsmin added this', "has passthrough-added content" );
60 $m->content_contains( 'function just_testing', "has not-by-default.js" );
61 $m->content_contains('jQuery.noConflict', "found default js content");
62 RT::Test->stop_server;
65 diag "test squished files with devel mode enabled";
66 RT->Config->Set( 'DevelMode' => 1 );
67 RT->AddJavaScript( 'not-by-default.js' );
68 RT->AddStyleSheets( 'nottherebutwedontcare.css' );
70 ( $url, $m ) = RT::Test->started_ok;
72 $m->content_unlike( qr!squished-.*?\.(js|css)!,
73 'no squished link with develmode' );
75 $m->content_contains('not-by-default.js', "found extra javascript resource");
76 $m->content_contains('nottherebutwedontcare.css', "found extra css resource");
77 $m->content_contains('jquery_noconflict.js', "found a default js resource");