@@ -109,9 +109,58 @@ def test_us002_legacy_themes(dash_duo, theme):
109109
110110 # Base styles: assert that the grid height is <= 400px because an unstyled
111111 # grid is very "tall"
112- root_wrapper = dash_duo .find_element (".ag-root-wrapper" )
113- wrapper_height = root_wrapper .size ["height" ]
114- assert wrapper_height <= 400 , f"Grid appears to be unstyled: height is too tall ({ wrapper_height } px)"
112+ until (
113+ lambda : dash_duo .find_element (".ag-root-wrapper" ).size ["height" ] <= 400 ,
114+ timeout = 3 ,
115+ msg = f"Grid appears to be unstyled: height is too tall ({ dash_duo .find_element ('.ag-root-wrapper' ).size ['height' ]} px)"
116+ )
117+ # Specific themes: Assert that cell headers are bold
118+ header_cell_text = dash_duo .find_element (".ag-header-cell-text" )
119+ font_weight = header_cell_text .value_of_css_property ("font-weight" )
120+ assert font_weight in ["bold" , "700" , "600" , "500" ,], "Grid appears to be unstyled: cell headers are not bold"
121+
122+ @pytest .mark .parametrize ("theme" , ["themeAlpine" , "themeBalham" , "themeMaterial" , "themeQuartz" ])
123+ def test_us003_part_themes (dash_duo , theme ):
124+ app = Dash (
125+ __name__
126+ )
127+
128+ columnDefs = [
129+ {"field" : "name" , "width" : "500" },
130+ ]
131+
132+ rowData = [
133+ {"name" : "a" },
134+ {"name" : "b" },
135+ {"name" : "c" },
136+ ]
137+
138+ app .layout = html .Div (
139+ [
140+ dag .AgGrid (
141+ id = "grid" ,
142+ columnDefs = columnDefs ,
143+ rowData = rowData ,
144+ dashGridOptions = {'theme' : {'function' : f'customTheme({ theme } , agGrid)' }},
145+ ),
146+ ]
147+ )
148+
149+ dash_duo .start_server (app )
150+
151+ grid = utils .Grid (dash_duo , "grid" )
152+
153+ grid .wait_for_cell_text (0 , 0 , "a" )
154+
155+ # Test that the CSS files are actually loaded and applied
156+
157+ # Base styles: assert that the grid height is <= 400px because an unstyled
158+ # grid is very "tall"
159+ until (
160+ lambda : dash_duo .find_element (".ag-root-wrapper" ).size ["height" ] <= 400 ,
161+ timeout = 3 ,
162+ msg = f"Grid appears to be unstyled: height is too tall ({ dash_duo .find_element ('.ag-root-wrapper' ).size ['height' ]} px)"
163+ )
115164
116165 # Specific themes: Assert that cell headers are bold
117166 header_cell_text = dash_duo .find_element (".ag-header-cell-text" )
0 commit comments