diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c41036..f064e81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- **`auth_logo` is wired up.** The config block has shipped since 1.0 but no + view ever read it, so enabling it did nothing. The auth pages now render the + configured image — honouring `class`, `width` and `height`, and omitting each + attribute when its config value is empty — above the text `logo`. With + `auth_logo.enabled` left at its `false` default the auth pages are unchanged. + ## [1.2.0] - 2026-08-11 ### Added diff --git a/resources/views/auth/auth-master.blade.php b/resources/views/auth/auth-master.blade.php index 6726887..f7875c7 100644 --- a/resources/views/auth/auth-master.blade.php +++ b/resources/views/auth/auth-master.blade.php @@ -19,6 +19,19 @@
+ @if (config('adminlte.auth_logo.enabled', false)) + {{ config('adminlte.auth_logo.img.alt') }} + @endif {!! config('adminlte.logo', 'AdminLTE') !!}
diff --git a/tests/AuthLogoTest.php b/tests/AuthLogoTest.php new file mode 100644 index 0000000..3718ea7 --- /dev/null +++ b/tests/AuthLogoTest.php @@ -0,0 +1,90 @@ +withoutVite(); + + // auth-master's children link to the named login route. + Route::get('login', fn () => '')->name('login'); + } + + private function renderLogin(): string + { + return view('adminlte::auth.login')->withErrors([])->render(); + } + + public function test_auth_logo_is_absent_by_default(): void + { + // `auth_logo.enabled` ships false — the auth pages show the text logo + // only. Nothing may reference the image path, which no install step + // publishes. + $html = $this->renderLogin(); + + $this->assertStringNotContainsString('AdminLTELogo.png', $html); + $this->assertStringContainsString('AdminLTE', $html); + } + + public function test_auth_logo_renders_when_enabled(): void + { + config()->set('adminlte.auth_logo.enabled', true); + + $html = $this->renderLogin(); + + $this->assertStringContainsString(asset('vendor/adminlte/img/AdminLTELogo.png'), $html); + $this->assertStringContainsString('alt="Auth Logo"', $html); + $this->assertStringContainsString('width="50"', $html); + $this->assertStringContainsString('height="50"', $html); + } + + public function test_auth_logo_honours_img_overrides(): void + { + config()->set('adminlte.auth_logo', [ + 'enabled' => true, + 'img' => [ + 'path' => 'img/brand.svg', + 'alt' => 'Acme', + 'class' => 'rounded me-2', + 'width' => 120, + 'height' => 40, + ], + ]); + + $html = $this->renderLogin(); + + $this->assertStringContainsString(asset('img/brand.svg'), $html); + $this->assertStringContainsString('alt="Acme"', $html); + $this->assertStringContainsString('class="rounded me-2"', $html); + $this->assertStringContainsString('width="120"', $html); + $this->assertStringContainsString('height="40"', $html); + } + + public function test_optional_img_attributes_are_omitted_when_empty(): void + { + config()->set('adminlte.auth_logo', [ + 'enabled' => true, + 'img' => [ + 'path' => 'img/brand.svg', + 'alt' => 'Acme', + 'class' => '', + 'width' => null, + 'height' => null, + ], + ]); + + $html = $this->renderLogin(); + + // Note: the quoted forms only — the viewport meta carries an unquoted + // `width=device-width`. + $this->assertStringNotContainsString('width="', $html); + $this->assertStringNotContainsString('height="', $html); + $this->assertStringNotContainsString('class=""', $html); + } +}