File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -171,8 +171,23 @@ describe("T33 · 列折叠 Flip(路径 B:`data-flip-id` 跨元素配对)",
171171 expect ( before . filter ( ( p ) => ANIMATABLE_PROPERTIES . includes ( p ) ) , "渲染期不该写合成属性" ) . toEqual ( [ ] ) ;
172172 } ) ;
173173
174- it ( "C4 reduced-motion 降级:命中 `prefers-reduced-motion: reduce` ⇒ **不建**时间线(宽度照旧瞬跳)" , async ( ) => {
175- const stub = installMatchMediaStub ( { reduce : true } ) ;
174+ it ( "C4 reduced-motion 优先于档位:命中 `reduce` ⇒ **不建**时间线(同树下 `reduce:false` 为**阳性对照**)" , async ( ) => {
175+ // 🔴 档位必须**显式**记成 standard:`useMotionIntensity` 的初值**跟随系统** ⇒ reduce 命中时档位自身就变成
176+ // `eco`,那样本判据会被「eco 不播」这条旁路**假绿**(T33 变异体 M4 实测踩到:删掉 reduced 分支仍全绿)。
177+ window . localStorage . setItem ( "motion:intensity" , "standard" ) ;
178+ const noReduce = installMatchMediaStub ( { reduce : false } ) ;
179+ try {
180+ render ( < Harness /> ) ;
181+ await flush ( ) ;
182+ fireEvent . click ( screen . getByTestId ( "toggle" ) ) ;
183+ await flush ( ) ;
184+ expect ( handle ?. current , "阳性对照失败:未 reduce 时本该建时间线(否则本判据测不到东西)" ) . not . toBeNull ( ) ;
185+ } finally {
186+ noReduce . restore ( ) ;
187+ }
188+ cleanup ( ) ;
189+
190+ const reduce = installMatchMediaStub ( { reduce : true } ) ;
176191 try {
177192 render ( < Harness /> ) ;
178193 await flush ( ) ;
@@ -181,7 +196,7 @@ describe("T33 · 列折叠 Flip(路径 B:`data-flip-id` 跨元素配对)",
181196 expect ( handle ?. current , "reduced-motion 下仍建了时间线(§8.5 要求跳终态)" ) . toBeNull ( ) ;
182197 expect ( screen . getByTestId ( "column-bar" ) . getAttribute ( "data-flip-id" ) , "降级不该破坏结构契约" ) . toBe ( ID ) ;
183198 } finally {
184- stub . restore ( ) ;
199+ reduce . restore ( ) ;
185200 }
186201 } ) ;
187202
You can’t perform that action at this time.
0 commit comments