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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
use strict;
use warnings;
use RT;
use RT::Test tests => 26;
RT->Config->Set( DevelMode => 0 );
RT->Config->Set( WebDefaultStylesheet => 'aileron' );
RT->Config->Set( MasonLocalComponentRoot => RT::Test::get_abs_relocatable_dir('html') );
my ( $url, $m ) = RT::Test->started_ok;
$m->login;
diag "test squished files with devel mode disabled";
$m->follow_link_ok( { url_regex => qr!aileron-squished-([a-f0-9]{32})\.css! },
'follow squished css' );
$m->content_like( qr!/\*\* End of .*?.css \*/!, 'squished css' );
$m->content_lacks( 'text-decoration: underline !important;',
'no print.css by default' );
$m->back;
my ($js_link) =
$m->content =~ m!src="([^"]+?squished-([a-f0-9]{32})\.js)"!;
$m->get_ok( $url . $js_link, 'follow squished js' );
$m->content_lacks('function just_testing', "no not-by-default.js");
$m->content_contains('jQuery.noConflict', "found default js content");
RT::Test->stop_server;
diag "test squished files with customized files and devel mode disabled";
RT->AddJavaScript( 'not-by-default.js' );
RT->AddStyleSheets( 'print.css' );
( $url, $m ) = RT::Test->started_ok;
$m->login;
$m->follow_link_ok( { url_regex => qr!aileron-squished-([a-f0-9]{32})\.css! },
'follow squished css' );
$m->content_like( qr!/\*\* End of .*?.css \*/!, 'squished css' );
$m->content_contains( 'text-decoration: underline !important;',
'has print.css' );
$m->back;
($js_link) =
$m->content =~ m!src="([^"]+?squished-([a-f0-9]{32})\.js)"!;
$m->get_ok( $url . $js_link, 'follow squished js' );
$m->content_contains( 'function just_testing', "has not-by-default.js" );
$m->content_contains('jQuery.noConflict', "found default js content");
RT::Test->stop_server;
diag "Test with a trivial jsmin which is a pass-through";
RT->Config->Set( 'JSMinPath' => RT::Test::get_abs_relocatable_dir("passthrough-jsmin"));
( $url, $m ) = RT::Test->started_ok;
$m->login;
($js_link) =
$m->content =~ m!src="([^"]+?squished-([a-f0-9]{32})\.js)"!;
$m->get_ok( $url . $js_link, 'follow squished js' );
$m->content_contains( 'passthrough-jsmin added this', "has passthrough-added content" );
$m->content_contains( 'function just_testing', "has not-by-default.js" );
$m->content_contains('jQuery.noConflict', "found default js content");
RT::Test->stop_server;
diag "test squished files with devel mode enabled";
RT->Config->Set( 'DevelMode' => 1 );
RT->AddJavaScript( 'not-by-default.js' );
RT->AddStyleSheets( 'nottherebutwedontcare.css' );
( $url, $m ) = RT::Test->started_ok;
$m->login;
$m->content_unlike( qr!squished-.*?\.(js|css)!,
'no squished link with develmode' );
$m->content_contains('not-by-default.js', "found extra javascript resource");
$m->content_contains('nottherebutwedontcare.css', "found extra css resource");
$m->content_contains('jquery_noconflict.js', "found a default js resource");
|