libra/tests/Feature/Mail/EmailTemplateColorsTest.php

138 lines
5.4 KiB
PHP

<?php
use Illuminate\Support\Facades\File;
// Story 12.4: Email Template Color Update - Dark Charcoal & Warm Gold palette
// Colors: Warm Gold #A68966, Forest Green #2D322A, Dark Forest Green #2D3624,
// Gold Light #C4A882, Warm Cream #F4F1EA, White #FFFFFF
test('default.css uses warm gold color for links', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
expect($css)->toContain('a {')
->and($css)->toContain('color: #A68966;');
});
test('default.css uses forest green color for h1 headings', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
expect($css)->toMatch('/h1\s*\{[^}]*color:\s*#2D322A;/');
});
test('default.css uses forest green color for h2 headings', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
expect($css)->toMatch('/h2\s*\{[^}]*color:\s*#2D322A;/');
});
test('default.css uses forest green color for h3 headings', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
expect($css)->toMatch('/h3\s*\{[^}]*color:\s*#2D322A;/');
});
test('default.css uses dark forest green for header background', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
expect($css)->toMatch('/\.header\s*\{[^}]*background-color:\s*#2D3624;/');
});
test('default.css uses warm gold color for footer links', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
expect($css)->toMatch('/\.footer a\s*\{[^}]*color:\s*#A68966;/');
});
test('default.css uses dark forest green for table headers with white text', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
expect($css)->toMatch('/\.table th\s*\{[^}]*background-color:\s*#2D3624;/')
->and($css)->toMatch('/\.table th\s*\{[^}]*color:\s*#FFFFFF;/');
});
test('default.css uses warm gold background for primary buttons', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
expect($css)->toMatch('/\.button-primary\s*\{[^}]*background-color:\s*#A68966;/');
});
test('default.css uses white text for primary buttons', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
expect($css)->toMatch('/\.button-primary\s*\{[^}]*color:\s*#FFFFFF;/');
});
test('default.css uses gold light color for panel border', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
expect($css)->toMatch('/\.panel\s*\{[^}]*border-left:\s*#C4A882/');
});
test('default.css uses warm cream for body background', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
expect($css)->toMatch('/body\s*\{[^}]*background-color:\s*#F4F1EA;/')
->and($css)->toMatch('/\.wrapper\s*\{[^}]*background-color:\s*#F4F1EA;/')
->and($css)->toMatch('/\.body\s*\{[^}]*background-color:\s*#F4F1EA;/');
});
test('default.css uses forest green for body text', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
expect($css)->toMatch('/body\s*\{[^}]*color:\s*#2D322A;/');
});
test('default.css uses forest green for footer paragraph text', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
expect($css)->toMatch('/\.footer p\s*\{[^}]*color:\s*#2D322A;/');
});
test('header.blade.php uses dark forest green background color', function () {
$header = File::get(resource_path('views/vendor/mail/html/header.blade.php'));
expect($header)->toContain('background-color: #2D3624;');
});
test('header.blade.php does not use old green color', function () {
$header = File::get(resource_path('views/vendor/mail/html/header.blade.php'));
expect($header)->not->toContain('#8AB357');
});
test('footer.blade.php uses warm gold color for links', function () {
$footer = File::get(resource_path('views/vendor/mail/html/footer.blade.php'));
expect($footer)->toContain('color: #A68966;');
});
test('footer.blade.php uses forest green for text', function () {
$footer = File::get(resource_path('views/vendor/mail/html/footer.blade.php'));
expect($footer)->toContain('color: #2D322A;');
});
test('footer.blade.php does not use old light green color', function () {
$footer = File::get(resource_path('views/vendor/mail/html/footer.blade.php'));
expect($footer)->not->toContain('#A5C87A');
});
test('default.css does not use old green color for headings and links', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
// Check that old green colors are not used
expect($css)->not->toMatch('/h1\s*\{[^}]*color:\s*#6A9337;/')
->and($css)->not->toMatch('/h2\s*\{[^}]*color:\s*#6A9337;/')
->and($css)->not->toMatch('/h3\s*\{[^}]*color:\s*#6A9337;/')
->and($css)->not->toContain('color: #8AB357;');
});
test('default.css does not use old green color for buttons and panels', function () {
$css = File::get(resource_path('views/vendor/mail/html/themes/default.css'));
// Check that old green colors are not used in buttons and panels
expect($css)->not->toMatch('/\.button-primary\s*\{[^}]*background-color:\s*#8AB357;/')
->and($css)->not->toMatch('/\.panel\s*\{[^}]*border-left:\s*#A5C87A/');
});