Skip to content

Commit

Permalink
Issue #4027: improved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chzauleck committed Jan 21, 2025
1 parent ea27e47 commit 35336fb
Showing 1 changed file with 7 additions and 24 deletions.
31 changes: 7 additions & 24 deletions scripts/test/Layout/RichTextDocumentComplete.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use utf8;

# CPAN modules
use Test2::V0;
use CSS::Minifier::XS ();

# OTOBO modules
use Kernel::System::UnitTest::RegisterOM; # Set up $Kernel::OM
Expand All @@ -39,31 +38,17 @@ my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
### Setting up

# Minimize amount of added CSS for testing
my $TestCustomCSS = '';
my $TestCKEditorContentCSS = '';

my $TestCKEditorContentCSSPath = '';
my $StandardContentCSSPath = $ConfigObject->Get('Home') . '/var/httpd/htdocs/skins/Agent/default/css/RichTextArticleContent.css';

$Helper->ConfigSettingChange(
Key => 'Frontend::RichText::DefaultCSS',
Value => $TestCustomCSS,
Value => '',
Valid => 1,
);
$Helper->ConfigSettingChange(
Key => 'Frontend::RichTextArticleStyles',
Value => $TestCKEditorContentCSSPath,
Value => '',
Valid => 1,
);

my $StandardContentCSS = ${
$MainObject->FileRead(
Location => $StandardContentCSSPath,
)
};

our $MinifiedCSS = CSS::Minifier::XS::minify($StandardContentCSS);

my @Tests = (
{
Line => __LINE__,
Expand Down Expand Up @@ -102,17 +87,15 @@ my @Tests = (
for my $Test (@Tests) {

my $Result = $Test->{Result};
my $HTMLString = $Test->{String}


my $HTMLString = $LayoutObject->RichTextDocumentComplete(
String => $Test->{String},
);

#Remove OTOBO Copyright comment for easier testing
$Result =~ s/\/\*[\s\S]*?\*\///;
$HTMLString =~ s/\/\*[\s\S]*?\*\///;

$LayoutObject->RichTextDocumentComplete(
String => $HTMLString,
);


TextEqOrDiff(
"$HTMLString\n",
"$Result\n",
Expand Down

0 comments on commit 35336fb

Please sign in to comment.