@@ -3,6 +3,8 @@ import { expect } from 'chai';
3
3
import { createRenderer , screen } from '@mui/internal-test-utils' ;
4
4
import AppBar , { appBarClasses as classes } from '@mui/material/AppBar' ;
5
5
import Paper from '@mui/material/Paper' ;
6
+ import { ThemeProvider , CssVarsProvider , hexToRgb } from '@mui/material/styles' ;
7
+ import defaultTheme from '../styles/defaultTheme' ;
6
8
import describeConformance from '../../test/describeConformance' ;
7
9
8
10
describe ( '<AppBar />' , ( ) => {
@@ -62,4 +64,42 @@ describe('<AppBar />', () => {
62
64
expect ( appBar ) . to . have . class ( 'mui-fixed' ) ;
63
65
} ) ;
64
66
} ) ;
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
+ } ) ;
65
105
} ) ;
0 commit comments