@@ -24,7 +24,7 @@ import type { SurfaceLevel, SurfaceRadius, SurfaceTag } from "./index";
2424
2525/** 契约名单:与 `Surface.css` 的规则一一对应(改名单必须同时改 CSS 与测试) */
2626const LEVELS : readonly SurfaceLevel [ ] = [ "sunken" , "canvas" , "surface" , "raised" ] ;
27- const RADIUS : readonly SurfaceRadius [ ] = [ "stamp" , "control" , "panel" , "overlay" ] ;
27+ const RADIUS : readonly SurfaceRadius [ ] = [ "stamp" , "control" , "panel" , "overlay" , "pill" ] ;
2828const TAGS : ReadonlyArray < readonly [ SurfaceTag , string ] > = [
2929 [ "div" , "DIV" ] , [ "section" , "SECTION" ] , [ "article" , "ARTICLE" ] , [ "aside" , "ASIDE" ] , [ "li" , "LI" ] ,
3030] ;
@@ -60,21 +60,28 @@ describe("Surface 默认契约", () => {
6060 } ) ;
6161} ) ;
6262
63- describe ( "Surface 四档底 / 四档圆角映射到类 " , ( ) => {
63+ describe ( "Surface 四档底 / 五档圆角映射到类 " , ( ) => {
6464 it ( "4 档 level 各有对应类(sunken 输入槽 · canvas 纸 · surface 卡面 · raised 弹层)" , ( ) => {
6565 for ( const level of LEVELS ) {
6666 const cls = classesOf ( render ( < Surface level = { level } > x</ Surface > ) . container ) ;
6767 expect ( cls , `档位 ${ level } ` ) . toContain ( `ed-surface--${ level } ` ) ;
6868 }
6969 } ) ;
7070
71- it ( "4 档 radius 各有对应类(3/5/8/10px 由 token 决定,原语只出档名)" , ( ) => {
71+ it ( "5 档 radius 各有对应类(3/5/8/10px 由 token 决定,原语只出档名)" , ( ) => {
7272 for ( const radius of RADIUS ) {
7373 const cls = classesOf ( render ( < Surface radius = { radius } > x</ Surface > ) . container ) ;
7474 expect ( cls , `圆角 ${ radius } ` ) . toContain ( `ed-surface--r-${ radius } ` ) ;
7575 }
7676 } ) ;
7777
78+ it ( "第五档 `pill`(批 4 T17 的药丸裁决):类名与档名一致,且**不**落内联 style(值由 CSS 的 var 兜底给)" , ( ) => {
79+ const { container } = render ( < Surface radius = "pill" > x</ Surface > ) ;
80+ expect ( classesOf ( container ) ) . toContain ( "ed-surface--r-pill" ) ;
81+ // 原语只出档名、值只在 CSS:这条守住「token 真源补 pill 之前也不许把 999px 内联进来」
82+ expect ( root ( container ) . style . borderRadius ) . toBe ( "" ) ;
83+ } ) ;
84+
7885 it ( "结构不变量:level 类与 radius 类各至多一个(不产生两档叠加态)" , ( ) => {
7986 const cls = classesOf ( render ( < Surface level = "raised" radius = "overlay" > x</ Surface > ) . container ) ;
8087 expect ( cls . filter ( ( c ) => LEVELS . some ( ( l ) => c === `ed-surface--${ l } ` ) ) ) . toHaveLength ( 1 ) ;
0 commit comments