22-05-2026 Optimierung der User und Admin Panels
This commit is contained in:
parent
d2ba22c0cf
commit
e8c47b7553
73 changed files with 10282 additions and 1546 deletions
44
tests/Feature/LocalFontsTest.php
Normal file
44
tests/Feature/LocalFontsTest.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
test('views load fonts from local assets only', function () {
|
||||
$externalFontHosts = [
|
||||
'fonts.bunny.net',
|
||||
'fonts.googleapis.com',
|
||||
'fonts.gstatic.com',
|
||||
];
|
||||
|
||||
foreach (File::allFiles(resource_path('views')) as $view) {
|
||||
$contents = File::get($view->getRealPath());
|
||||
|
||||
foreach ($externalFontHosts as $host) {
|
||||
$this->assertStringNotContainsString(
|
||||
$host,
|
||||
$contents,
|
||||
$view->getRelativePathname().' references '.$host,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$localFontLinks = view('partials.local-fonts')->render();
|
||||
|
||||
expect($localFontLinks)
|
||||
->toContain('fonts/inter-tight/font.css')
|
||||
->toContain('fonts/source-serif-4/font.css')
|
||||
->toContain('fonts/jetbrains-mono/font.css');
|
||||
});
|
||||
|
||||
test('local font stylesheets reference font files relative to their directories', function () {
|
||||
foreach (File::allFiles(public_path('fonts')) as $file) {
|
||||
if ($file->getExtension() !== 'css') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->assertStringNotContainsString(
|
||||
'../fonts/',
|
||||
File::get($file->getRealPath()),
|
||||
$file->getRelativePathname().' still points outside its font directory',
|
||||
);
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue