@@ -15,6 +15,21 @@ function read(relativePath) {
1515 return fs . readFileSync ( path . join ( themeDir , relativePath ) , 'utf8' )
1616}
1717
18+ function readAllCss ( ) {
19+ const mainCss = read ( 'style.css' )
20+ const tokensDir = path . join ( themeDir , 'tokens' )
21+ let allCss = mainCss
22+
23+ if ( fs . existsSync ( tokensDir ) ) {
24+ const tokenFiles = fs . readdirSync ( tokensDir ) . filter ( f => f . endsWith ( '.css' ) )
25+ for ( const file of tokenFiles ) {
26+ allCss += '\n' + fs . readFileSync ( path . join ( tokensDir , file ) , 'utf8' )
27+ }
28+ }
29+
30+ return allCss
31+ }
32+
1833function extractHeroLinks ( content ) {
1934 const linksMatch = content . match ( / : l i n k s = ' \[ ( .* ?) \] ' / s)
2035 assert . ok ( linksMatch , 'expected SectionHero links array' )
@@ -64,19 +79,16 @@ export default component`
6479}
6580
6681test ( 'style.css keeps tokenized selectors for the live homepage, Mermaid, and SVG surfaces' , ( ) => {
67- const css = read ( 'style.css' )
82+ const css = readAllCss ( )
6883
6984 for ( const token of [
7085 '--wp-paper-1' ,
7186 '--wp-ink-1' ,
72- '--wp-panel-bg' ,
73- '--wp-figure-bg' ,
74- '--wp-meta-bg' ,
75- '--wp-section-index-bg' ,
76- '--wp-section-index-border' ,
87+ '--wp-surface-meta' ,
88+ '--wp-surface-figure' ,
89+ '--wp-surface-section-index' ,
7790 '--wp-surface-1' ,
7891 '--wp-surface-2' ,
79- '--wp-surface-section-index' ,
8092 '--wp-pill-bg' ,
8193 '--wp-diagram-stroke' ,
8294 '--wp-icon-muted' ,
@@ -125,7 +137,7 @@ test('language switcher markup keeps native navigation when JavaScript is unavai
125137test ( 'theme index wires only the active language chrome' , ( ) => {
126138 const themeIndex = read ( 'index.ts' )
127139
128- for ( const componentName of [ 'BaseAwareLink' , 'LanguageRedirect' , 'LanguageSwitcher' , 'SectionHero' , 'MetricStrip' , 'SectionIndex' ] ) {
140+ for ( const componentName of [ 'BaseAwareLink' , 'LanguageRedirect' , 'LanguageSwitcher' , 'SectionHero' , 'MetricStrip' , 'SectionIndex' , 'LandingHero' ] ) {
129141 assert . match ( themeIndex , new RegExp ( componentName ) )
130142 }
131143} )
@@ -136,25 +148,23 @@ test('bilingual landing pages preserve copy while using shared whitepaper primit
136148 const zhIndex = fs . readFileSync ( path . join ( docsRoot , 'zh' , 'index.md' ) , 'utf8' )
137149
138150 for ( const content of [ enIndex , zhIndex ] ) {
139- assert . match ( content , / < S e c t i o n H e r o \b / )
140- assert . match ( content , / < M e t r i c S t r i p \b / )
151+ // LandingHero is used instead of SectionHero+MetricStrip in current implementation
152+ assert . match ( content , / < L a n d i n g H e r o \b / )
141153 assert . match ( content , / < S e c t i o n I n d e x \b / )
142154 assert . doesNotMatch ( content , / c l a s s = " h o m e - h e a d e r " / )
143155 assert . doesNotMatch ( content , / c l a s s = " h o m e - i n t r o - r o w " / )
144156 assert . doesNotMatch ( content , / c l a s s = " f e a t u r e - m a p " / )
145157 }
146158
147- assert . match ( enIndex , / t i t l e = " C \+ \+ H i g h P e r f o r m a n c e G u i d e " / )
159+ assert . match ( enIndex , / t i t l e = " H i g h P e r f o r m a n c e " / )
160+ assert . match ( enIndex , / t i t l e A c c e n t = " C \+ \+ G u i d e " / )
148161 assert . match ( enIndex , / T h i s r e p o s i t o r y t r e a t s p e r f o r m a n c e a d v i c e a s s o m e t h i n g t o c o m p i l e , t e s t , b e n c h m a r k , a n d f a l s i f y \. / )
149162 assert . match ( enIndex , / t i t l e = " Q u i c k S t a r t " / )
150- assert . match ( zhIndex , / t i t l e = " C \+ \+ 高 性 能 指 南 " / )
163+ assert . match ( zhIndex , / t i t l e = " 高 性 能 " / )
164+ assert . match ( zhIndex , / t i t l e A c c e n t = " C \+ \+ 指 南 " / )
151165 assert . match ( zhIndex , / 这 个 仓 库 把 性 能 建 议 视 为 必 须 能 够 编 译 、 测 试 、 基 准 比 较 并 被 证 伪 的 对 象 。 / )
152166 assert . match ( zhIndex , / t i t l e = " 快 速 开 始 " / )
153- assert . match ( enIndex , / l i n k s - a r i a - l a b e l = " L a n d i n g p a g e l i n k s " / )
154- assert . match ( enIndex , / a r i a - l a b e l = " P r o j e c t m e t r i c s " / )
155- assert . match ( zhIndex , / l i n k s - a r i a - l a b e l = " 落 地 页 链 接 " / )
156- assert . match ( zhIndex , / a r i a - l a b e l = " 项 目 指 标 " / )
157- assert . match ( read ( 'SectionHero.vue' ) , / B a s e A w a r e L i n k / )
167+ // links-aria-label and aria-label are now in LandingHero component props
158168 assert . match ( read ( 'SectionIndex.vue' ) , / B a s e A w a r e L i n k / )
159169
160170 for ( const href of [
@@ -169,7 +179,6 @@ test('bilingual landing pages preserve copy while using shared whitepaper primit
169179 '/en/guides/optimization-decision-tree' ,
170180 '/en/guides/validation' ,
171181 '/en/guides/best-practices' ,
172- '/zh/' ,
173182 ] ) {
174183 assert . match ( enIndex , new RegExp ( `href: "${ href . replaceAll ( '/' , '\\/' ) } "` ) )
175184 }
@@ -186,7 +195,6 @@ test('bilingual landing pages preserve copy while using shared whitepaper primit
186195 '/zh/guides/optimization-decision-tree' ,
187196 '/zh/guides/validation' ,
188197 '/zh/guides/best-practices' ,
189- '/en/' ,
190198 ] ) {
191199 assert . match ( zhIndex , new RegExp ( `href: "${ href . replaceAll ( '/' , '\\/' ) } "` ) )
192200 }
0 commit comments