Skip to content

Commit 8b8be75

Browse files
authored
Merge pull request #1276 from mito-ds/default-color-to-none
mitosheet: fix bug with not supplying background_color
2 parents 77c466d + cfcd20c commit 8b8be75

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

mitosheet/mitosheet/tests/streamlit/test_streamlit.py

+27
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,31 @@ def test_spreadsheet_with_column_definitions():
137137
code_options={'as_function': True, 'call_function': False, 'function_name': 'test', 'function_params': {}},
138138
return_type='function'
139139
)
140+
assert callable(f)
141+
142+
@requires_streamlit
143+
def test_spreadsheet_with_column_definitions_only_one_color():
144+
f = spreadsheet(
145+
df1,
146+
column_definitions=[
147+
[
148+
{
149+
'columns': ['A'],
150+
'conditional_formats': [{
151+
'filters': [{'condition': 'greater_than_or_equal', 'value': 5}],
152+
'font_color': '#c30010',
153+
}]
154+
},
155+
{
156+
'columns': ['A'],
157+
'conditional_formats': [{
158+
'filters': [{'condition': 'less', 'value': 2}],
159+
'background_color': '#ddcbd1'
160+
}]
161+
}
162+
]
163+
],
164+
code_options={'as_function': True, 'call_function': False, 'function_name': 'test', 'function_params': {}},
165+
return_type='function'
166+
)
140167
assert callable(f)

mitosheet/mitosheet/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def get_default_df_formats(column_definitions: Optional[List[ColumnDefinitions]]
366366
'filters': conditional_format['filters'],
367367
'invalidFilterColumnIDs': [],
368368
'color': font_color,
369-
'backgroundColor': conditional_format['background_color']
369+
'backgroundColor': background_color
370370
}
371371

372372
conditional_formats.append(new_conditional_format)

0 commit comments

Comments
 (0)