File tree Expand file tree Collapse file tree 2 files changed +12
-16
lines changed
ansible_ai_connect_chatbot/src Expand file tree Collapse file tree 2 files changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -371,19 +371,15 @@ test("Color theme switch", async () => {
371371 if ( colorThemeSwitch ) {
372372 expect ( colorThemeSwitch . checked ) . toBeFalsy ( ) ;
373373
374- const { getComputedStyle } = window ;
375- const showLight = view . container . querySelector ( ".show-light" ) ;
376- const showDark = view . container . querySelector ( ".show-dark" ) ;
377- expect ( getComputedStyle ( showLight ! ) . display ) . toEqual ( "block" ) ;
378-
379- // NOTE: seem to be broken?
380- // expect(getComputedStyle(showDark!).display).toEqual("none")
374+ const htmlElementClassList =
375+ document . getElementsByTagName ( "html" ) [ 0 ] . classList ;
376+ expect ( htmlElementClassList . length ) . equals ( 0 ) ;
381377
382378 await colorThemeSwitch . click ( ) ;
383379 expect ( colorThemeSwitch . checked ) . toBeTruthy ( ) ;
384380
385- // expect(getComputedStyle(showLight!).display).toEqual("none")
386- expect ( getComputedStyle ( showDark ! ) . display ) . toEqual ( "block ") ;
381+ expect ( htmlElementClassList . length ) . equals ( 1 ) ;
382+ expect ( htmlElementClassList [ 0 ] ) . equals ( "pf-v6-theme-dark ") ;
387383 }
388384} ) ;
389385
Original file line number Diff line number Diff line change @@ -8,13 +8,13 @@ export const ColorThemeSwitch = () => {
88 checked : boolean ,
99 ) => {
1010 setIsChecked ( checked ) ;
11- const element = document . getElementsByTagName ( "html" ) ;
12- element [ 0 ] . classList . remove (
13- checked ? "pf-v6-theme-light" : "pf-v6-theme-dark" ,
14- ) ;
15- element [ 0 ] . classList . add (
16- checked ? "pf-v6-theme-dark" : "pf-v6-theme-light" ,
17- ) ;
11+ const htmlElementClassList =
12+ document . getElementsByTagName ( "html" ) [ 0 ] . classList ;
13+ if ( checked ) {
14+ htmlElementClassList . add ( "pf-v6-theme-dark" ) ;
15+ } else {
16+ htmlElementClassList . remove ( "pf-v6-theme-dark" ) ;
17+ }
1818 } ;
1919
2020 return (
You can’t perform that action at this time.
0 commit comments