@@ -25,31 +25,26 @@ describe("standard painted theme colors", () => {
2525 it ( "match the chip surfaces index.css paints" , ( ) => {
2626 const root = document . documentElement ;
2727 try {
28- for ( const redesign of [ false , true , false ] ) {
29- root . toggleAttribute ( "data-redesign" , redesign ) ;
30- for ( const appearance of [ "light" , "dark" ] as const ) {
31- root . classList . toggle ( "dark" , appearance === "dark" ) ;
32- const colors = getStandardPaintedThemeColors ( appearance , redesign ) ;
33- const canvas = paintedChannels ( "--background" ) ;
34- for ( const [ variable , role ] of [
35- [ "--background" , "canvas" ] ,
36- [ "--card" , "surface" ] ,
37- [ "--surface-raised" , "surfaceRaised" ] ,
38- [ "--message-surface" , "messageSurface" ] ,
39- ] as const ) {
40- const expected = toRgb ( colors [ role ] ) ! ;
41- const painted = paintedChannels ( variable , canvas ) ;
42- [ expected . r , expected . g , expected . b ] . forEach ( ( channel , index ) => {
43- expect (
44- Math . abs ( channel * 255 - painted [ index ] ! ) ,
45- `${ appearance } ${ role } ` ,
46- ) . toBeLessThan ( 1.5 ) ;
47- } ) ;
48- }
28+ for ( const appearance of [ "light" , "dark" ] as const ) {
29+ root . classList . toggle ( "dark" , appearance === "dark" ) ;
30+ const colors = getStandardPaintedThemeColors ( appearance ) ;
31+ const canvas = paintedChannels ( "--background" ) ;
32+ for ( const [ variable , role ] of [
33+ [ "--background" , "canvas" ] ,
34+ [ "--card" , "surface" ] ,
35+ [ "--surface-raised" , "surfaceRaised" ] ,
36+ [ "--message-surface" , "messageSurface" ] ,
37+ ] as const ) {
38+ const expected = toRgb ( colors [ role ] ) ! ;
39+ const painted = paintedChannels ( variable , canvas ) ;
40+ [ expected . r , expected . g , expected . b ] . forEach ( ( channel , index ) => {
41+ expect ( Math . abs ( channel * 255 - painted [ index ] ! ) , `${ appearance } ${ role } ` ) . toBeLessThan (
42+ 1.5 ,
43+ ) ;
44+ } ) ;
4945 }
5046 }
5147 } finally {
52- root . removeAttribute ( "data-redesign" ) ;
5348 root . classList . remove ( "dark" ) ;
5449 }
5550 } ) ;
0 commit comments