forked from fa/breadcrumb-the-shire
Notices used to be styled only inside the toast stack — every inline .notice on the login page, auth pages and admin edit screens fell back to browser defaults and looked unstyled. The Stripe-style toast redesign (icon pill + neutral text + soft card surface) now lives on the base .notice rule, and .app-toast-stack adds the slide-in animation, soft shadow, dismiss button and progress bar on top. Inline notices auto-render the variant icon via a ::before pseudo using the Bootstrap Icons codepoints, so all 30+ existing call sites get the new look without markup changes. Toasts opt out of ::before via :has(> .notice-icon) and keep their explicit icon span. The previous app-flash.phtml partial is folded into app-toast-stack.phtml (both create the same .app-toast-stack container — having both mounted made two stacks fight for the same fixed corner). default/login/page templates now mount the unified partial; the architecture contract is updated to match. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
66 lines
3.5 KiB
PHP
66 lines
3.5 KiB
PHP
<?php
|
|
|
|
namespace MintyPHP\Tests\Architecture;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class FrontendRuntimeHostContractTest extends TestCase
|
|
{
|
|
use ProjectFileAssertionSupport;
|
|
|
|
public function testHostBoundComponentsExposeDataAppComponentMarkupHosts(): void
|
|
{
|
|
$defaultTemplate = $this->readProjectFile('templates/default.phtml');
|
|
$loginTemplate = $this->readProjectFile('templates/login.phtml');
|
|
$flashPartial = $this->readProjectFile('templates/partials/app-toast-stack.phtml');
|
|
$topbarPartial = $this->readProjectFile('templates/partials/app-topbar.phtml');
|
|
$asideIconBar = $this->readProjectFile('templates/partials/app-main-aside-icon-bar.phtml');
|
|
$asidePartial = $this->readProjectFile('templates/partials/app-main-aside.phtml');
|
|
$bookmarkDialog = $this->readProjectFile('modules/bookmarks/templates/bookmark-dialogs.phtml');
|
|
$bookmarkPanelTemplate = $this->readProjectFile('modules/bookmarks/templates/aside-bookmarks-panel.phtml');
|
|
$sessionWarningDialog = $this->readProjectFile('templates/partials/app-session-warning-dialog.phtml');
|
|
|
|
$this->assertStringContainsString('id="page-config-app-components"', $defaultTemplate);
|
|
$this->assertStringContainsString('id="page-config-login-components"', $loginTemplate);
|
|
$this->assertStringNotContainsString("assetVersion('js/components/app-bookmark-init.js')", $defaultTemplate);
|
|
|
|
$this->assertStringContainsString('data-app-component="flash-auto-dismiss"', $flashPartial);
|
|
$this->assertStringContainsString('data-app-component="tenant-switcher"', $topbarPartial);
|
|
$this->assertStringContainsString('data-app-component="theme-controls"', $topbarPartial);
|
|
$this->assertStringContainsString('data-app-component="contrast-toggle"', $topbarPartial);
|
|
$this->assertStringContainsString('data-app-component="details-aside-toggle"', $topbarPartial);
|
|
$this->assertStringContainsString('data-app-component="aside-panels"', $asideIconBar);
|
|
$this->assertStringContainsString('data-app-component="sidebar-toggle"', $asidePartial);
|
|
$searchDialog = $this->readProjectFile('templates/partials/app-search-dialog.phtml');
|
|
$this->assertStringContainsString('data-app-component="global-search"', $searchDialog);
|
|
$this->assertStringContainsString('data-app-component="bookmark-panel"', $bookmarkPanelTemplate);
|
|
$this->assertStringContainsString('data-app-component="bookmark-save"', $bookmarkDialog);
|
|
$this->assertStringContainsString('data-app-component="session-warning"', $sessionWarningDialog);
|
|
}
|
|
|
|
public function testTabsHostsUseDataAppComponentContract(): void
|
|
{
|
|
$files = [
|
|
'templates/partials/app-user-profile.phtml',
|
|
'pages/admin/departments/_form.phtml',
|
|
'pages/admin/permissions/_form.phtml',
|
|
'pages/admin/roles/_form.phtml',
|
|
'pages/admin/stats/index(default).phtml',
|
|
'pages/admin/tenants/_form.phtml',
|
|
'pages/admin/users/_form.phtml',
|
|
];
|
|
|
|
foreach ($files as $file) {
|
|
$content = $this->readProjectFile($file);
|
|
$this->assertStringContainsString('data-tabs', $content, $file);
|
|
$this->assertStringContainsString('data-app-component="tabs"', $content, $file);
|
|
}
|
|
}
|
|
|
|
public function testRolesFormUsesTokenSelectHost(): void
|
|
{
|
|
$rolesForm = $this->readProjectFile('pages/admin/roles/_form.phtml');
|
|
$this->assertStringContainsString('tokenSelectForm(', $rolesForm);
|
|
}
|
|
}
|