Skip to content

Commit

Permalink
Issue #1197: adapt the expected output after minification
Browse files Browse the repository at this point in the history
JavaScript::Minifier::XS does not strip the copyright,
which is a good thing.
  • Loading branch information
bschmalhofer committed Nov 16, 2023
1 parent 48b668c commit 91778bd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
7 changes: 4 additions & 3 deletions scripts/test/Loader.t
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ my $Home = $ConfigObject->Get('Home');
);
$ExpectedJS = ${$ExpectedJS};
$ExpectedJS =~ s{\r\n}{\n}xmsg;
$ExpectedJS =~ s{\n$}{}; # newline after the last line

is( $MinifiedJS || '', $ExpectedJS, 'MinifyJavaScript()' );
is( $MinifiedJS, $ExpectedJS, 'MinifyJavaScript()' );
}

{
Expand Down Expand Up @@ -150,6 +151,7 @@ my $Home = $ConfigObject->Get('Home');
);
$Expected = ${$Expected};
$Expected =~ s{\r\n}{\n}xmsg;
$Expected =~ s{\n$}{}; # newline after the last line

is( $MinifiedJS, $Expected, 'MinifyFiles() result content' );

Expand All @@ -176,5 +178,4 @@ for my $Test (@JSTests) {
is( $Result, $Test->{Result}, $Test->{Name} );
}

# cleanup cache is done by RestoreDatabase
done_testing();
done_testing;
5 changes: 4 additions & 1 deletion scripts/test/sample/Loader/CombinedJavaScript.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions scripts/test/sample/Loader/OTOBO.Agent.App.Login.min.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (C) 2001-2020 OTRS AG, https://otrs.com/
// Copyright (C) 2019-2023 Rother OSS GmbH, https://otobo.de/
"use strict";var OTOBO=OTOBO||{};OTOBO.Agent=OTOBO.Agent||{};OTOBO.Agent.App=OTOBO.Agent.App||{};OTOBO.Agent.App.Login=(function(TargetNS){TargetNS.Init=function(){if(!OTOBO.Debug.BrowserCheck()){$('#LoginBox').hide();$('#OldBrowser').show();return;}
OTOBO.Form.EnableForm($('#LoginBox form, #PasswordBox form'));if($('#User').val()&&$('#User').val().length){$('#Password').focus();}
else{$('#User').focus();}
Expand Down

0 comments on commit 91778bd

Please sign in to comment.