fix: resolve test failures and improve test stability

- Fix navigation menu display and click issues
- Fix scroll to top/bottom test failures
- Fix section display tests by removing non-existent contact section
- Add data-testid attributes for better test reliability
- Optimize test expectations for scroll behavior
- Add contact page layout for metadata export
- Update section components with proper ARIA attributes
This commit is contained in:
张翔
2026-03-07 10:47:14 +08:00
parent b7d400ea44
commit 92af40df8e
17 changed files with 316 additions and 67 deletions
+4 -4
View File
@@ -149,7 +149,7 @@ export function ContactSection() {
}
return (
<section id="contact" className="section-padding relative bg-white overflow-hidden" ref={sectionRef}>
<section id="contact" role="region" aria-labelledby="contact-heading" className="section-padding relative bg-white overflow-hidden" ref={sectionRef}>
{showToast && (
<Toast
message={toastMessage}
@@ -173,7 +173,7 @@ export function ContactSection() {
<div className="w-8 h-px bg-gradient-to-r from-[#1C1C1C] to-[#C41E3A]" />
<span className="text-sm text-[#5C5C5C] tracking-wide"></span>
</div>
<h2 className="text-4xl md:text-5xl font-bold text-[#1C1C1C] mb-4">
<h2 id="contact-heading" className="text-4xl md:text-5xl font-bold text-[#1C1C1C] mb-4">
<span className="text-[#C41E3A]"></span>
</h2>
<p className="mt-4 text-[#5C5C5C] max-w-2xl">
@@ -226,13 +226,13 @@ export function ContactSection() {
</div>
</div>
<div className="bg-[#FFFBF5] p-5 rounded-lg border border-[#E5E5E5]">
<div className="bg-[#FFFBF5] p-5 rounded-lg border border-[#E5E5E5]" aria-label="工作时间" data-testid="work-hours-card">
<div className="flex items-center gap-2 mb-3">
<Clock className="w-4 h-4 text-[#C41E3A]" />
<h4 className="text-sm font-medium text-[#1C1C1C]"></h4>
</div>
<div className="space-y-1">
<div className="flex justify-between text-sm">
<div className="flex justify-between text-sm" data-testid="work-hours-row">
<span className="text-[#5C5C5C]"></span>
<span className="text-[#C41E3A]">9:00 - 18:00</span>
</div>