Преглед изворни кода

去掉'不含今日';单日不显示时间文案

tianyu.chu пре 1 месец
родитељ
комит
32a5779d44

+ 3 - 3
apps/web/src/modules/funnel/FunnelPage.tsx

@@ -69,10 +69,10 @@ export function FunnelPage() {
             }}
             onPickRolling={(p) => setPeriod(p)}
           />
-          {/* 时间边界:简短日期,不含今日 */}
-          {mutation.data?.snapshot_dt && (
+          {/* 滚动周期显示日期范围;单日不显示(日期已在按钮上) */}
+          {mutation.data?.snapshot_dt && period !== 'day' && (
             <span className="text-xs text-muted-foreground">
-              {funnelRangeText(period, mutation.data.snapshot_dt)} · 不含今日
+              {funnelRangeText(period, mutation.data.snapshot_dt)}
             </span>
           )}
         </div>

+ 13 - 3
apps/web/src/modules/funnel/__tests__/FunnelPage.test.tsx

@@ -133,11 +133,21 @@ describe('FunnelPage — fixed funnel + period selection', () => {
     }
   });
 
-  it('shows a terse time-boundary line under the control (date + 不含今日)', async () => {
+  it('date range shows only for rolling periods; nothing for 单日; no 不含今日', async () => {
     queryFunnelMock.mockResolvedValue(readyResponse());
+    const user = userEvent.setup();
     renderPage();
-    // default 单日 → 「2026-06-23 · 不含今日」(精简,无"数据日期"前缀)
-    expect(await screen.findByText(/2026-06-23 · 不含今日/)).toBeInTheDocument();
+
+    // default 单日 → 无边界文案
+    await waitFor(() => expect(lastPeriod()).toBe('day'));
+    expect(screen.queryByText(/不含今日/)).not.toBeInTheDocument();
+    expect(screen.queryByText(/~/)).not.toBeInTheDocument();
+
+    // 近 7 天 → 显示日期范围,且无"不含今日"
+    await user.click(screen.getByRole('button', { name: '近 7 天' }));
+    await waitFor(() => expect(lastPeriod()).toBe('last_7d'));
+    expect(screen.getByText(/2026-06-17 ~ 2026-06-23/)).toBeInTheDocument();
+    expect(screen.queryByText(/不含今日/)).not.toBeInTheDocument();
   });
 
   /** Open the always-on 单日 calendar popover and return its dialog. */