refactor(Timestamp): 规范化页面组件目录结构

- 将子组件移至 components/ 子目录(LiveClock、ResultView)
- 创建 __tests__/ 目录结构
- 更新所有相关导入路径

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
雨霖铃
2026-06-10 21:16:12 +08:00
parent 9c5f5c8cfe
commit 24c83de56d
4 changed files with 15 additions and 4 deletions
@@ -0,0 +1,11 @@
import { render, screen } from '@testing-library/react';
import { describe, it, expect } from 'vitest';
import Index from '../index';
describe('Timestamp 页面', () => {
it('应该渲染页面标题', () => {
render(<Index />);
// 基本渲染测试
expect(screen.getByRole('button')).toBeInTheDocument();
});
});
@@ -2,8 +2,8 @@ import React, { useEffect, useState } from 'react';
import { Clock } from 'lucide-react'; import { Clock } from 'lucide-react';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { CopyButton } from '@/components/CopyButton'; import { CopyButton } from '@/components/CopyButton';
import type { UnitType } from './constants'; import type { UnitType } from '../constants';
import { msToUnit } from './constants'; import { msToUnit } from '../constants';
import { useI18n } from '@/utils/chromeI18n'; import { useI18n } from '@/utils/chromeI18n';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
+2 -2
View File
@@ -1,8 +1,8 @@
import SwitchButtonGroup from '@/components/SwitchButtonGroup'; import SwitchButtonGroup from '@/components/SwitchButtonGroup';
import { ZONES } from './constants'; import { ZONES } from './constants';
import type { ModeType, UnitType, ZoneType } from './constants'; import type { ModeType, UnitType, ZoneType } from './constants';
import LiveClock from './LiveClock'; import LiveClock from './components/LiveClock';
import ResultView from './ResultView'; import ResultView from './components/ResultView';
import { useTimestampConverter } from './useTimestampConverter'; import { useTimestampConverter } from './useTimestampConverter';
import { useI18n } from '@/utils/chromeI18n'; import { useI18n } from '@/utils/chromeI18n';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';