File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -96,3 +96,27 @@ def test_css_contains_dark_mode_media_query():
9696 with mock .patch .object (TableWidget , "_initial_load" ):
9797 widget = TableWidget (mock_df )
9898 assert "@media (prefers-color-scheme: dark)" in widget ._css
99+
100+
101+ def test_css_styles_traitlet_is_populated ():
102+ """Verify that css_styles traitlet is populated from the external CSS file."""
103+ from bigframes .display .anywidget import TableWidget
104+
105+ # Mock the dataframe and its block
106+ mock_df = mock .create_autospec (bigframes .dataframe .DataFrame , instance = True )
107+ mock_df .columns = ["col1" ]
108+ mock_df .dtypes = {"col1" : "object" }
109+ mock_block = mock .Mock ()
110+ mock_block .has_index = False
111+ mock_df ._block = mock_block
112+
113+ # Mock _initial_load to avoid side effects
114+ with mock .patch .object (TableWidget , "_initial_load" ):
115+ widget = TableWidget (mock_df )
116+
117+ # Check that css_styles is not empty
118+ assert widget .css_styles
119+
120+ # Check that it contains expected CSS content (e.g. dark mode query)
121+ assert "@media (prefers-color-scheme: dark)" in widget .css_styles
122+ assert ".bigframes-widget" in widget .css_styles
You can’t perform that action at this time.
0 commit comments