Skip to content

Commit

Permalink
add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
maximlt committed Oct 14, 2022
1 parent ca28b0e commit 9dfd0c3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions panel/tests/ui/widgets/test_tabulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3482,3 +3482,23 @@ def test_tabulator_python_filter_edit(page, port):
wait_until(lambda: len(values) == 2, page)
assert values[-1] == ('values', len(df) - 1, 'X', 'Y')
assert df.at['idx3', 'values'] == 'Y'


def test_tabulator_sorter_default_number(page, port):
df = pd.DataFrame({'x': []}).astype({'x': int})
widget = Tabulator(df, sorters=[{"field": "x", "dir": "desc"}])

serve(widget, port=port, threaded=True, show=False)

time.sleep(0.2)

page.goto(f"http://localhost:{port}")

df2 = pd.DataFrame({'x': [0, 96, 116]})
widget.value = df2

def x_values():
table_values = [int(v) for v in tabulator_column_values(page, 'x')]
assert table_values == list(df2['x'].sort_values(ascending=False))

wait_until(x_values, page)

0 comments on commit 9dfd0c3

Please sign in to comment.