@@ -8,36 +8,48 @@ const desktopRoot = resolve(import.meta.dirname, '..')
88const mainSource = readFileSync ( resolve ( desktopRoot , 'src' , 'main.ts' ) , 'utf8' )
99
1010describe ( 'desktop window appearance configuration' , ( ) => {
11- it ( 'keeps Windows opaque and non-Windows windows transparent ' , ( ) => {
11+ it ( 'keeps the main window opaque on every platform ' , ( ) => {
1212 const backgroundMaterialMatches = [ ...mainSource . matchAll ( / b a c k g r o u n d M a t e r i a l / gu) ]
13- const win32BranchMatches = [ ...mainSource . matchAll (
14- / \. \. \. \( p r o c e s s \. p l a t f o r m = = = ' w i n 3 2 ' \? \{ ( [ \s \S ] * ?) \} : \{ \s * t r a n s p a r e n t : t r u e , / gu,
15- ) ]
16- const nonWin32BranchMatches = [ ...mainSource . matchAll (
17- / \} : \{ \s * t r a n s p a r e n t : t r u e , [ \s \S ] * ?\} \) , \s * t i t l e : / gu,
13+ const mainWindowOptionMatches = [ ...mainSource . matchAll (
14+ / c o n s t w i n d o w = n e w B r o w s e r W i n d o w \( \{ ( [ \s \S ] * ?) \n \} \) / gu,
1815 ) ]
1916
2017 expect ( backgroundMaterialMatches ) . toHaveLength ( 0 )
21- expect ( win32BranchMatches ) . toHaveLength ( 1 )
22- expect ( nonWin32BranchMatches ) . toHaveLength ( 1 )
18+ expect ( mainWindowOptionMatches ) . toHaveLength ( 1 )
2319
24- const win32Branch = win32BranchMatches [ 0 ] ! [ 1 ] !
25- const opaqueColorMatches = [ ...win32Branch . matchAll ( / b a c k g r o u n d C o l o r : \s * ' # [ 0 - 9 a - f A - F ] { 6 } ' / gu) ]
26- const alphaColorMatches = [ ...win32Branch . matchAll ( / # [ 0 - 9 a - f A - F ] { 8 } / gu) ]
27- const hasShadowMatches = [ ...win32Branch . matchAll ( / h a s S h a d o w : \s * t r u e / gu) ]
28- const roundedCornersMatches = [ ...win32Branch . matchAll ( / r o u n d e d C o r n e r s : \s * t r u e / gu) ]
29- const thickFrameMatches = [ ...win32Branch . matchAll ( / t h i c k F r a m e : \s * t r u e / gu) ]
20+ const mainWindowOptions = mainWindowOptionMatches [ 0 ] ! [ 1 ] !
21+ const vibrancyMatches = [ ...mainWindowOptions . matchAll ( / v i b r a n c y \s * : / gu) ]
22+ const visualEffectStateMatches = [ ...mainWindowOptions . matchAll ( / v i s u a l E f f e c t S t a t e \s * : / gu) ]
23+ const transparentMatches = [ ...mainWindowOptions . matchAll ( / t r a n s p a r e n t : \s * t r u e / gu) ]
24+ const backgroundColorMatches = [ ...mainWindowOptions . matchAll (
25+ / b a c k g r o u n d C o l o r : \s * ' ( # [ 0 - 9 a - f A - F ] { 6 } (?: [ 0 - 9 a - f A - F ] { 2 } ) ? ) ' / gu,
26+ ) ]
27+ const transparentBackgroundMatches = backgroundColorMatches . filter (
28+ ( match ) => match [ 1 ] ! . length === 9 && match [ 1 ] ! . endsWith ( '00' ) ,
29+ )
30+ const hasShadowMatches = [ ...mainWindowOptions . matchAll (
31+ / h a s S h a d o w : \s * p r o c e s s \. p l a t f o r m = = = ' w i n 3 2 ' \? t r u e : u n d e f i n e d / gu,
32+ ) ]
33+ const roundedCornersMatches = [ ...mainWindowOptions . matchAll (
34+ / r o u n d e d C o r n e r s : \s * p r o c e s s \. p l a t f o r m = = = ' w i n 3 2 ' \? t r u e : u n d e f i n e d / gu,
35+ ) ]
36+ const thickFrameMatches = [ ...mainWindowOptions . matchAll (
37+ / t h i c k F r a m e : \s * p r o c e s s \. p l a t f o r m = = = ' w i n 3 2 ' \? t r u e : u n d e f i n e d / gu,
38+ ) ]
3039
31- expect ( opaqueColorMatches ) . toHaveLength ( 1 )
32- expect ( alphaColorMatches ) . toHaveLength ( 0 )
40+ expect ( vibrancyMatches ) . toHaveLength ( 0 )
41+ expect ( visualEffectStateMatches ) . toHaveLength ( 0 )
42+ expect ( transparentMatches ) . toHaveLength ( 0 )
43+ expect ( backgroundColorMatches ) . toHaveLength ( 1 )
44+ expect ( backgroundColorMatches [ 0 ] ! [ 1 ] ) . not . toBe ( '#00000000' )
45+ expect ( transparentBackgroundMatches ) . toHaveLength ( 0 )
3346 expect ( hasShadowMatches ) . toHaveLength ( 1 )
3447 expect ( roundedCornersMatches ) . toHaveLength ( 1 )
3548 expect ( thickFrameMatches ) . toHaveLength ( 1 )
3649
37- expect ( win32Branch ) . toContain ( 'backgroundColor' )
38- expect ( nonWin32BranchMatches [ 0 ] ! [ 0 ] ) . toContain ( 'transparent: true' )
39- expect ( win32Branch ) . toContain ( 'hasShadow' )
40- expect ( win32Branch ) . toContain ( 'roundedCorners' )
41- expect ( win32Branch ) . toContain ( 'thickFrame' )
50+ expect ( mainWindowOptions ) . toContain ( 'backgroundColor' )
51+ expect ( mainWindowOptions ) . toContain ( 'hasShadow' )
52+ expect ( mainWindowOptions ) . toContain ( 'roundedCorners' )
53+ expect ( mainWindowOptions ) . toContain ( 'thickFrame' )
4254 } )
4355} )
0 commit comments