feat(marketing): 重构营销页面与四层叙事组件体系
- 重构 About、Contact、Team 等静态营销页面 - 重构 News 新闻列表与详情页 - 重构 Products 产品目录、详情与独立产品页面 - 重构 Services 与 Solutions 服务/解决方案页面 - 重构 Detail 四层叙事组件 (Hero → Value → Trust → CTA) - 重构 Sections 页面区块组件 (Hero, CTA, SocialProof, WhyUs 等) - 新增 SectionHeader、ServiceCard、CaseCard 等可复用组件
This commit is contained in:
@@ -54,6 +54,10 @@ jest.mock('lucide-react', () => ({
|
||||
MapPin: () => <span data-testid="map-pin-icon" />,
|
||||
Mail: () => <span data-testid="mail-icon" />,
|
||||
Phone: () => <span data-testid="phone-icon" />,
|
||||
Trophy: () => <span data-testid="trophy-icon" />,
|
||||
Shield: () => <span data-testid="shield-icon" />,
|
||||
Zap: () => <span data-testid="zap-icon" />,
|
||||
ArrowUpRight: () => <span data-testid="arrow-up-right-icon" />,
|
||||
}));
|
||||
|
||||
jest.mock('@/components/ui/card', () => {
|
||||
@@ -98,6 +102,23 @@ jest.mock('date-fns', () => ({
|
||||
subMonths: (d: Date) => d,
|
||||
}));
|
||||
|
||||
jest.mock('./about-content-v4', () => {
|
||||
const MockAboutContentV4 = () => (
|
||||
<div className="min-h-screen" data-testid="about-content">
|
||||
<h1>关于我们</h1>
|
||||
<section>
|
||||
<h2>发展历程</h2>
|
||||
<h2>核心价值观</h2>
|
||||
<h2>团队组建</h2>
|
||||
<h2>联系我们</h2>
|
||||
<span>研发产品</span>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
MockAboutContentV4.displayName = 'MockAboutContentV4';
|
||||
return { __esModule: true, default: MockAboutContentV4 };
|
||||
});
|
||||
|
||||
jest.mock('@/lib/constants', () => ({
|
||||
COMPANY_INFO: {
|
||||
name: '四川睿新致远科技有限公司',
|
||||
@@ -116,6 +137,10 @@ jest.mock('@/lib/constants', () => ({
|
||||
],
|
||||
}));
|
||||
|
||||
jest.mock('@/lib/cms/data-server', () => ({
|
||||
getPublishedItems: jest.fn(() => Promise.resolve([{ data: {} }])),
|
||||
}));
|
||||
|
||||
import AboutPage from './page';
|
||||
|
||||
describe('AboutPage', () => {
|
||||
@@ -124,52 +149,60 @@ describe('AboutPage', () => {
|
||||
});
|
||||
|
||||
describe('Rendering', () => {
|
||||
it('should render about page', () => {
|
||||
const { container } = render(<AboutPage />);
|
||||
it('should render about page', async () => {
|
||||
const pageElement = await AboutPage();
|
||||
const { container } = render(pageElement);
|
||||
const pageContainer = container.querySelector('.min-h-screen');
|
||||
expect(pageContainer).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render company introduction', () => {
|
||||
render(<AboutPage />);
|
||||
it('should render company introduction', async () => {
|
||||
const pageElement = await AboutPage();
|
||||
render(pageElement);
|
||||
const intros = screen.getAllByText(/关于我们/i);
|
||||
expect(intros.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should render company history', () => {
|
||||
render(<AboutPage />);
|
||||
it('should render company history', async () => {
|
||||
const pageElement = await AboutPage();
|
||||
render(pageElement);
|
||||
const history = screen.getByText(/发展历程/i);
|
||||
expect(history).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render company culture', () => {
|
||||
render(<AboutPage />);
|
||||
it('should render company culture', async () => {
|
||||
const pageElement = await AboutPage();
|
||||
render(pageElement);
|
||||
const culture = screen.getByText(/核心价值观/i);
|
||||
expect(culture).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render team members', () => {
|
||||
render(<AboutPage />);
|
||||
it('should render team members', async () => {
|
||||
const pageElement = await AboutPage();
|
||||
render(pageElement);
|
||||
const team = screen.getByText(/团队组建/i);
|
||||
expect(team).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render contact information', () => {
|
||||
render(<AboutPage />);
|
||||
it('should render contact information', async () => {
|
||||
const pageElement = await AboutPage();
|
||||
render(pageElement);
|
||||
const contact = screen.getByText(/联系我们/i);
|
||||
expect(contact).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render statistics', () => {
|
||||
render(<AboutPage />);
|
||||
it('should render statistics', async () => {
|
||||
const pageElement = await AboutPage();
|
||||
render(pageElement);
|
||||
const stats = screen.getByText(/研发产品/i);
|
||||
expect(stats).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Accessibility', () => {
|
||||
it('should have proper heading hierarchy', () => {
|
||||
render(<AboutPage />);
|
||||
it('should have proper heading hierarchy', async () => {
|
||||
const pageElement = await AboutPage();
|
||||
render(pageElement);
|
||||
const h1 = screen.getByRole('heading', { level: 1 });
|
||||
expect(h1).toBeInTheDocument();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user