@@ -16,6 +16,21 @@ function read(relativePath) {
1616 return fs . readFileSync ( path . join ( themeDir , relativePath ) , 'utf8' )
1717}
1818
19+ function readAllCss ( ) {
20+ const mainCss = read ( 'style.css' )
21+ const tokensDir = path . join ( themeDir , 'tokens' )
22+ let allCss = mainCss
23+
24+ if ( fs . existsSync ( tokensDir ) ) {
25+ const tokenFiles = fs . readdirSync ( tokensDir ) . filter ( file => file . endsWith ( '.css' ) )
26+ for ( const file of tokenFiles ) {
27+ allCss += `\n${ fs . readFileSync ( path . join ( tokensDir , file ) , 'utf8' ) } `
28+ }
29+ }
30+
31+ return allCss
32+ }
33+
1934function extractLandingArray ( content , propName ) {
2035 const match = content . match ( new RegExp ( `:${ propName } ='\\[(.*?)\\]'` , 's' ) )
2136
@@ -92,8 +107,7 @@ async function loadSfcComponent(relativePath) {
92107}
93108
94109test ( 'style.css keeps tokenized selectors for the live homepage, Mermaid, and SVG surfaces' , ( ) => {
95- const css = read ( 'style.css' )
96- const colorTokens = read ( 'tokens/colors.css' )
110+ const css = readAllCss ( )
97111
98112 for ( const token of [
99113 '--wp-paper-1' ,
@@ -109,7 +123,7 @@ test('style.css keeps tokenized selectors for the live homepage, Mermaid, and SV
109123 '--wp-diagram-stroke' ,
110124 '--wp-icon-muted' ,
111125 ] ) {
112- assert . match ( colorTokens , new RegExp ( token . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, '\\$&' ) ) )
126+ assert . match ( css , new RegExp ( token . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, '\\$&' ) ) )
113127 }
114128
115129 for ( const selector of [
@@ -187,6 +201,7 @@ test('bilingual landing pages preserve copy while using shared whitepaper primit
187201
188202 assert . match ( enIndex , / < B a s e A w a r e L i n k h r e f = " \/ e n \/ g e t t i n g - s t a r t e d \/ q u i c k s t a r t " > Q u i c k S t a r t g u i d e < \/ B a s e A w a r e L i n k > / )
189203 assert . match ( zhIndex , / < B a s e A w a r e L i n k h r e f = " \/ z h \/ g e t t i n g - s t a r t e d \/ q u i c k s t a r t " > 快 速 开 始 指 南 < \/ B a s e A w a r e L i n k > / )
204+ assert . match ( read ( 'SectionIndex.vue' ) , / B a s e A w a r e L i n k / )
190205 assert . match ( enIndex , / : a c t i o n s = ' / )
191206 assert . match ( zhIndex , / : a c t i o n s = ' / )
192207 assert . doesNotMatch ( enIndex , / h r e f : " \. \/ / )
0 commit comments