Skip to content

Commit 550af07

Browse files
test: add basic tests for import_luxon method
1 parent 730b5a2 commit 550af07

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

tests/test_tabulator.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from nicegui import ui
55
from .screen import BrowserManager
66
from playwright.sync_api import expect, Locator, Page
7-
from nicegui_tabulator import tabulator, CellSlotProps
7+
from nicegui_tabulator import tabulator, CellSlotProps, import_luxon
88
import pandas as pd
99

1010

@@ -939,3 +939,36 @@ def build_table():
939939

940940
body_expect = expect(page.locator("body"))
941941
body_expect.to_contain_text("works")
942+
943+
944+
def test_import_luxon(browser: BrowserManager, page_path: str):
945+
@ui.page(page_path)
946+
def _():
947+
import_luxon()
948+
949+
tabledata = [
950+
{"id": 1, "dob": "1982-05-14"},
951+
{"id": 2, "dob": "1999-01-31"},
952+
]
953+
954+
table_config = {
955+
"data": tabledata,
956+
"columns": [
957+
{
958+
"title": "dob",
959+
"field": "dob",
960+
"formatter": "datetime",
961+
"formatterParams": {
962+
"inputFormat": "iso",
963+
"outputFormat": "dd/MM/yyyy",
964+
},
965+
},
966+
],
967+
}
968+
969+
tabulator(table_config).classes("target")
970+
971+
page = browser.open(page_path)
972+
table = page.locator(".target")
973+
expect(table).to_be_visible()
974+
check_table_rows(table, expected_data=[["14/05/1982"], ["31/01/1999"]])

0 commit comments

Comments
 (0)