{/*
* 微光效果 - 極淺的漸層覆蓋
@@ -509,8 +502,8 @@ export const SingleConverter = ({
onRateSourceChange={onRateSourceChange ?? (() => undefined)}
/>
- {/* 匯率顯示 - 使用 SSOT text 色 */}
-
+ {/* 匯率顯示 - 使用 SSOT text 色;固定高度避免計價基準 pill / live 匯率載入 CLS */}
+
@@ -521,15 +514,21 @@ export const SingleConverter = ({
>
1 {toCurrency} = {formatExchangeRate(reverseRate)} {fromCurrency}
+
+
+
+
+
{/* 滿版趨勢圖 - 無獨立背景,繼承父元素漸層實現一體化 */}
{
expect(trendChart).toHaveClass(className);
});
});
+
+ it('匯率文字區塊應預留計價基準 pill 槽位高度', () => {
+ render();
+
+ const rateTextBlock = screen.getByText(/1 TWD =/).parentElement;
+ expect(rateTextBlock).toHaveClass(singleConverterLayoutTokens.rateCard.rateTextBlock);
+ });
});
describe('匯率類型切換', () => {
@@ -433,21 +440,15 @@ describe('SingleConverter - 核心功能測試', () => {
});
});
- describe('趨勢圖進場動畫', () => {
- it('should show trend chart after 300ms delay', () => {
+ describe('趨勢圖 CLS 穩定', () => {
+ it('趨勢圖容器應自初始渲染起保持可見且固定高度', () => {
render();
- // 初始狀態不應該顯示趨勢圖(opacity-0)
- const trendContainer = document.querySelector('.opacity-0.translate-y-4');
- expect(trendContainer).toBeInTheDocument();
-
- // 300ms 後應該顯示(opacity-100)
- act(() => {
- vi.advanceTimersByTime(400);
+ const trendChart = screen.getByTestId('trend-chart');
+ expect(trendChart).not.toHaveClass('opacity-0');
+ singleConverterLayoutTokens.rateCard.chartHeight.split(' ').forEach((className) => {
+ expect(trendChart).toHaveClass(className);
});
-
- const visibleTrend = document.querySelector('.opacity-100.translate-y-0');
- expect(visibleTrend).toBeInTheDocument();
});
});
diff --git a/docs/dev/002_development_reward_penalty_log.md b/docs/dev/002_development_reward_penalty_log.md
index 37bc1f6ef..68190bc9a 100644
--- a/docs/dev/002_development_reward_penalty_log.md
+++ b/docs/dev/002_development_reward_penalty_log.md
@@ -2,7 +2,7 @@
> 版本:outline-v2-ultra
> 原則:每筆只保留日期、ID、原因、解法。
-> 本次分數變化:+1(reward 1、penalty 0、neutral 0)|累計總分:+74
+> 本次分數變化:+1(reward 1、penalty 0、neutral 0)|累計總分:+75
## 新增模板(4 行)
@@ -13,6 +13,11 @@
## 條目(新→舊)
+- 日期:2026-06-27
+- ID:reward-ratewise-homepage-cls-454-hotfix
+- 原因:#441 計價基準 pill 與趨勢圖進場動畫使首頁 CLS 達 0.237,超過 LHCI 門檻 0.1
+- 解法:SingleConverter 匯率卡片固定 min-height、預留 pill 槽位、移除趨勢圖 translate 動畫;RateWise footer 保留 min-h-6
+
- 日期:2026-06-27
- ID:reward-moneybox-schema-migration-cdn-fallback
- 原因:MoneyBox fetch 僅比對匯率數字,schema v2 遷移未觸發 data commit/purge;jsDelivr @data 分支快取最長 12h