fix(qa): 第五轮系统性质量保障缺陷修复 + 单元/集成测试
安全/鉴权:登出清服务端 httpOnly 令牌、登录 IP 限流前置 bcrypt、停用账号 令牌在 6 个内联 role handler 失效、admin/items 存在性 oracle 认证前置、 同意偏好 sanitize fail-closed、api-crypto 按 HTTP 方法判体。 CMS:workflow 状态更新+审计收进交互式 $transaction(失败即回滚)、编辑器 richtext 走 textarea 防换行损毁、array/object 子字段按作用域读写防污染、 about/contact/erp-upgrade 补 ISR revalidate 与路由映射。 UI/a11y:AnimatedCounter 入视口前显起点、CLS 累计上报、MetricCard 动画入 effect 并卸载取消 rAF、后台状态四态映射/搜索防抖+序号守卫/媒体单 input/ 吞错改横幅/表单 label-aria 关联。 新增对应判别性单测与 pagination/rate-limit/client-ip/sanitize/validate-content-data 等模块及 tests-integration 真库集成层。
This commit is contained in:
1 parent
040951c0a3
commit
a366bd1400
224 files changed
+8938
-5579
No files matched your search
@@ -18,7 +18,9 @@ function HeaderContent() {
|
||||
const [isScrolled, setIsScrolled] = useState(false);
|
||||
const [openDropdown, setOpenDropdown] = useState<string | null>(null);
|
||||
const pathname = usePathname();
|
||||
const focusTrapRef = useFocusTrap<HTMLDivElement>(isOpen);
|
||||
const focusTrapRef = useFocusTrap<HTMLDivElement>(isOpen, {
|
||||
onEscape: () => setIsOpen(false),
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const handleScroll = () => {
|
||||
@@ -86,8 +88,8 @@ function HeaderContent() {
|
||||
animate={{
|
||||
height: isScrolled ? 64 : 80,
|
||||
}}
|
||||
transition={{ duration: 0.3, ease: [0.22, 1, 0.36, 1] }}
|
||||
className="fixed top-0 left-0 right-0 z-50 transition-colors duration-300 bg-bg-primary border-b border-border-primary"
|
||||
transition={{ duration: 0.28, ease: [0.22, 1, 0.36, 1] }}
|
||||
className="fixed top-0 left-0 right-0 z-50 transition-colors duration-normal bg-bg-primary border-b border-border-primary"
|
||||
>
|
||||
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10">
|
||||
<div className="flex items-center justify-between h-16 md:h-full">
|
||||
@@ -103,7 +105,7 @@ function HeaderContent() {
|
||||
alt={config.name}
|
||||
width={160}
|
||||
height={40}
|
||||
className="logo-on-light relative transition-all duration-300 ease-out group-hover/logo:scale-[1.02] w-auto h-8 md:h-10"
|
||||
className="logo-on-light relative transition-all duration-normal ease-out group-hover/logo:scale-[1.02] w-auto h-8 md:h-10"
|
||||
loading="eager"
|
||||
priority
|
||||
suppressHydrationWarning
|
||||
@@ -113,7 +115,7 @@ function HeaderContent() {
|
||||
alt={config.name}
|
||||
width={160}
|
||||
height={40}
|
||||
className="logo-on-dark relative transition-all duration-300 ease-out group-hover/logo:scale-[1.02] w-auto h-8 md:h-10"
|
||||
className="logo-on-dark relative transition-all duration-normal ease-out group-hover/logo:scale-[1.02] w-auto h-8 md:h-10"
|
||||
loading="eager"
|
||||
suppressHydrationWarning
|
||||
/>
|
||||
@@ -141,7 +143,7 @@ function HeaderContent() {
|
||||
onClick={handleNavClick}
|
||||
className={cn(
|
||||
'relative inline-flex items-center px-3 py-2 text-sm font-medium',
|
||||
'transition-all duration-300 ease-out',
|
||||
'transition-all duration-normal ease-out',
|
||||
isActive(item)
|
||||
? 'text-text-primary'
|
||||
: 'text-text-secondary hover:text-text-primary hover:bg-bg-secondary'
|
||||
@@ -152,7 +154,7 @@ function HeaderContent() {
|
||||
<span
|
||||
className={cn(
|
||||
'absolute -bottom-0.5 left-3 right-3 h-0.5 bg-brand',
|
||||
'transition-all duration-300 ease-out',
|
||||
'transition-all duration-normal ease-out',
|
||||
isActive(item)
|
||||
? 'opacity-100 scale-x-100'
|
||||
: 'opacity-0 scale-x-0'
|
||||
@@ -180,11 +182,12 @@ function HeaderContent() {
|
||||
</div>
|
||||
|
||||
<button
|
||||
className="md:hidden p-2 -mr-2 text-text-secondary hover:text-text-primary hover:bg-bg-secondary rounded-sm transition-all duration-300 ease-out active:scale-95"
|
||||
onClick={() => setIsOpen(!isOpen)}
|
||||
className="md:hidden p-2 -mr-2 text-text-secondary hover:text-text-primary hover:bg-bg-secondary rounded-sm transition-all duration-normal ease-out active:scale-95"
|
||||
onClick={() => setIsOpen((prev) => !prev)}
|
||||
onKeyDown={handleKeyDown}
|
||||
aria-expanded={isOpen}
|
||||
aria-controls="mobile-menu"
|
||||
/* 面板仅在 isOpen 时挂载:关闭时不给 aria-controls,避免指向不存在的 id。 */
|
||||
aria-controls={isOpen ? 'mobile-menu' : undefined}
|
||||
aria-label={isOpen ? '关闭菜单' : '打开菜单'}
|
||||
data-testid="mobile-menu-button"
|
||||
style={{ minWidth: '44px', minHeight: '44px' }}
|
||||
@@ -221,6 +224,12 @@ function HeaderContent() {
|
||||
aria-label="移动端导航"
|
||||
data-testid="mobile-navigation"
|
||||
>
|
||||
{/* 桌面端 ThemeToggle 在 `hidden md:flex` 容器内,移动端只有抽屉可达;
|
||||
w-11 h-11 = 44px,满足触摸目标下限。放在 nav 之外,避免混入导航链接列表。 */}
|
||||
<div className="max-w-container mx-auto px-4 sm:px-6 pt-6 flex items-center justify-between">
|
||||
<span className="text-sm text-text-secondary">外观主题</span>
|
||||
<ThemeToggle className="w-11 h-11" />
|
||||
</div>
|
||||
<nav className="max-w-container mx-auto px-4 sm:px-6 py-6">
|
||||
{config.mainNav.map((item, index) => (
|
||||
<motion.div
|
||||
@@ -234,7 +243,7 @@ function HeaderContent() {
|
||||
onClick={handleNavClick}
|
||||
className={`
|
||||
block px-4 py-4 text-base font-medium
|
||||
transition-all duration-300 ease-out
|
||||
transition-all duration-normal ease-out
|
||||
${isActive(item)
|
||||
? 'text-text-primary bg-bg-secondary'
|
||||
: 'text-text-secondary hover:text-text-primary hover:bg-bg-secondary'
|
||||
|
||||
Reference in new issue
Block a user