Skip to content

Commit 8e906c7

Browse files
Added style test for merged columns.
1 parent 5121b54 commit 8e906c7

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

components/dash-table/tests/selenium/test_header.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,42 @@ def test_head005_no_warnings_emitted(test):
142142

143143
wait.until(lambda: target.column(6).get().get_attribute("colspan") == "4", 3)
144144
assert test.get_logs() == []
145+
146+
147+
def test_head006_style_merged_columns(test):
148+
app = get_app(
149+
dict(
150+
columns=[
151+
{"name": ("0"), "id": "x"},
152+
{"name": ("0"), "id": "y"},
153+
{"name": ("1", "1a"), "id": "a"},
154+
{"name": ("1", "1b"), "id": "b"},
155+
{"name": ("2", "2a"), "id": "c"},
156+
{"name": ("2", "2b"), "id": "d"},
157+
],
158+
merge_duplicate_headers=True,
159+
style_header_conditional=[
160+
{
161+
"if": {"column_id": f"{c}"},
162+
"backgroundColor": "green",
163+
"fontWeight": "bold",
164+
}
165+
for c in ["a", "b"]
166+
],
167+
)
168+
)
169+
170+
test.start_server(
171+
app,
172+
debug=True,
173+
use_reloader=False,
174+
use_debugger=True,
175+
dev_tools_hot_reload=False,
176+
)
177+
178+
target = test.table("table")
179+
wait.until(lambda: target.column(0).get_text(0) == "0", 3)
180+
assert "green" in target.column(2).get(0).get_attribute("style")
181+
assert "green" in target.column(2).get(1).get_attribute("style")
182+
assert "green" in target.column(3).get(1).get_attribute("style")
183+
assert test.get_logs() == []

0 commit comments

Comments
 (0)