@@ -3,6 +3,8 @@ import { expect } from 'chai';
33import { createRenderer , screen } from '@mui/internal-test-utils' ;
44import AppBar , { appBarClasses as classes } from '@mui/material/AppBar' ;
55import Paper from '@mui/material/Paper' ;
6+ import { ThemeProvider , CssVarsProvider , hexToRgb } from '@mui/material/styles' ;
7+ import defaultTheme from '../styles/defaultTheme' ;
68import describeConformance from '../../test/describeConformance' ;
79
810describe ( '<AppBar />' , ( ) => {
@@ -62,4 +64,42 @@ describe('<AppBar />', () => {
6264 expect ( appBar ) . to . have . class ( 'mui-fixed' ) ;
6365 } ) ;
6466 } ) ;
67+
68+ it ( 'should inherit Paper background color with ThemeProvider' , function test ( ) {
69+ if ( / j s d o m / . test ( window . navigator . userAgent ) ) {
70+ this . skip ( ) ;
71+ }
72+
73+ render (
74+ < ThemeProvider theme = { defaultTheme } >
75+ < AppBar data-testid = "root" color = "inherit" >
76+ Hello World
77+ </ AppBar >
78+ </ ThemeProvider > ,
79+ ) ;
80+
81+ const appBar = screen . getByTestId ( 'root' ) ;
82+ expect ( appBar ) . toHaveComputedStyle ( {
83+ backgroundColor : hexToRgb ( defaultTheme . palette . background . paper ) ,
84+ } ) ;
85+ } ) ;
86+
87+ it ( 'should inherit Paper background color with CssVarsProvider' , function test ( ) {
88+ if ( / j s d o m / . test ( window . navigator . userAgent ) ) {
89+ this . skip ( ) ;
90+ }
91+
92+ render (
93+ < CssVarsProvider >
94+ < AppBar data-testid = "root" color = "inherit" >
95+ Hello World
96+ </ AppBar >
97+ </ CssVarsProvider > ,
98+ ) ;
99+
100+ const appBar = screen . getByTestId ( 'root' ) ;
101+ expect ( appBar ) . toHaveComputedStyle ( {
102+ backgroundColor : hexToRgb ( defaultTheme . palette . background . paper ) ,
103+ } ) ;
104+ } ) ;
65105} ) ;
0 commit comments