Skip to content

Commit 6f05721

Browse files
test: columns with empty names in DataGrid
1 parent 846ef3a commit 6f05721

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import pandas as pd
2+
3+
from shiny import App, Inputs, reactive, render, ui
4+
5+
app_ui = ui.page_fluid(
6+
ui.output_data_frame("df1")
7+
)
8+
9+
10+
def server(input: Inputs):
11+
df = reactive.Value(pd.DataFrame({
12+
"": [1, 2],
13+
"A": [4, 5],
14+
" ": [7, 8]
15+
}))
16+
17+
@render.data_frame
18+
def df1():
19+
return render.DataGrid(df())
20+
21+
22+
app = App(app_ui, server)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from __future__ import annotations
2+
3+
from playwright.sync_api import Page
4+
5+
from shiny.playwright import controller
6+
from shiny.run import ShinyAppProc
7+
8+
9+
def test_row_selection(page: Page, local_app: ShinyAppProc) -> None:
10+
page.goto(local_app.url)
11+
12+
df = controller.OutputDataFrame(page, "df1")
13+
df.expect_nrow(2)
14+
df.expect_ncol(3)
15+
df.expect_column_labels(["", "A", " "])
16+
17+
df.expect_cell("1", row=0, col=0)
18+
df.expect_cell("2", row=1, col=0)
19+
df.expect_cell("4", row=0, col=1)
20+
df.expect_cell("8", row=1, col=2)

0 commit comments

Comments
 (0)