Skip to content

Commit 7a70ddb

Browse files
committed
Fix: table_id in DT
1 parent 73b7aa7 commit 7a70ddb

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/itables/shiny.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from .javascript import (
99
generate_init_offline_itables_html,
10+
replace_value,
1011
to_html_datatable,
1112
)
1213
from .typing import DataFrameOrSeries, ITableOptions
@@ -57,7 +58,11 @@ def DT(
5758

5859
script_end = "\n });\n</script>\n"
5960
assert html.endswith(script_end)
60-
assert "let dt = new ITable" in html
61+
html = replace_value(
62+
html,
63+
"new ITable(table, dt_args);",
64+
"let dt = new ITable(table, dt_args);",
65+
)
6166

6267
selected_rows_code = f"""
6368
function set_selected_rows_in_shiny(...args) {{

tests/test_shiny.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,7 @@ def test_shiny_apps_are_valid_python_scripts(
7575
if error in result.stderr:
7676
pytest.xfail(error)
7777
assert result.returncode == 0, f"Process failed: {result.stderr}"
78+
79+
80+
def test_table_id_in_DT():
81+
DT(df=None, table_id="my_table1")

0 commit comments

Comments
 (0)