CaiWuXiTong/tests/Unit/View/SidebarNavigationDesignTest.php
renshen 82ce1e52da 隐藏退款子菜单三角标识 (#33)
退款模块二级菜单不再显示活动三角标识,保留活动背景和一级展开箭头。
2026-08-12 10:58:17 +08:00

57 lines
2.4 KiB
PHP

<?php
namespace Tests\Unit\View;
use PHPUnit\Framework\TestCase;
class SidebarNavigationDesignTest extends TestCase
{
public function test_secondary_navigation_uses_one_active_indicator_without_tree_connectors(): void
{
$root = dirname(__DIR__, 3);
$source = file_get_contents($root . '/resources/assets/sass/app.css');
$compiled = file_get_contents($root . '/public/css/app.css');
$this->assertIsString($source);
$this->assertIsString($compiled);
$this->assertStringContainsString('.menu-active-indicator', $source);
$this->assertStringContainsString('.menu-active-indicator', $compiled);
$this->assertStringNotContainsString('.menu__submenu li::before', $source);
$this->assertStringNotContainsString('.menu__submenu details.relative:before', $source);
$this->assertStringNotContainsString('.menu__submenu li:before', $compiled);
$this->assertStringNotContainsString('.menu__submenu details.relative:before', $compiled);
}
public function test_order_data_navigation_hides_the_active_indicator(): void
{
$root = dirname(__DIR__, 3);
$source = file_get_contents($root . '/resources/assets/sass/app.css');
$compiled = file_get_contents($root . '/public/css/app.css');
$selector = '.finance-theme-sidebar .menu__submenu a[href*="/workspace/order-data/"] .menu-active-indicator';
$this->assertIsString($source);
$this->assertIsString($compiled);
$this->assertStringContainsString($selector, $source);
$this->assertMatchesRegularExpression(
'/' . preg_quote($selector, '/') . '\s*,?[^{}]*\{\s*display:\s*none;?\s*\}/',
$compiled
);
}
public function test_refund_navigation_hides_the_active_indicator(): void
{
$root = dirname(__DIR__, 3);
$source = file_get_contents($root . '/resources/assets/sass/app.css');
$compiled = file_get_contents($root . '/public/css/app.css');
$selector = '.finance-theme-sidebar .menu__submenu a[href*="/workspace/refunds/"] .menu-active-indicator';
$this->assertIsString($source);
$this->assertIsString($compiled);
$this->assertStringContainsString($selector, $source);
$this->assertMatchesRegularExpression(
'/' . preg_quote($selector, '/') . '\s*\{\s*display:\s*none;?\s*\}/',
$compiled
);
}
}