|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | 3 | import datetime as dt |
| 4 | +import typing as t |
4 | 5 |
|
5 | 6 | from contextlib import contextmanager |
6 | 7 |
|
@@ -3990,6 +3991,29 @@ def test_tabulator_local_pagination_page_size_preserved_on_value_none(page, df_m |
3990 | 3991 | expect(page.locator('.tabulator-row')).to_have_count(4) |
3991 | 3992 |
|
3992 | 3993 |
|
| 3994 | +def test_tabulator_local_pagination_auto_page_size_last_button(page): |
| 3995 | + # https://github.com/holoviz/panel/issues/8737 |
| 3996 | + df = pd.DataFrame({'value': range(6401)}) |
| 3997 | + widget = Tabulator(df, max_height=500, show_index=True) |
| 3998 | + |
| 3999 | + serve_component(page, widget) |
| 4000 | + |
| 4001 | + expect(page.locator('.tabulator-table')).to_have_count(1) |
| 4002 | + |
| 4003 | + wait_until(lambda: bool(widget.page_size), page) |
| 4004 | + initial_page_size = t.cast("int", widget.page_size) |
| 4005 | + counts = count_per_page(len(df), initial_page_size) |
| 4006 | + last_page = len(counts) |
| 4007 | + |
| 4008 | + page.locator('text="Last"').click() |
| 4009 | + page.wait_for_timeout(1000) |
| 4010 | + |
| 4011 | + assert widget.page_size == initial_page_size |
| 4012 | + assert widget.page == last_page |
| 4013 | + expect(page.locator('.tabulator-row')).to_have_count(counts[-1]) |
| 4014 | + expect(page.locator('.tabulator-row').last).to_contain_text(str(df['value'].iloc[-1])) |
| 4015 | + |
| 4016 | + |
3993 | 4017 | @pytest.mark.parametrize('pagination', ['local', 'remote', None]) |
3994 | 4018 | def test_selection_indices_on_paginated_and_filtered_data(page, df_strings, pagination): |
3995 | 4019 | tbl = Tabulator( |
|
0 commit comments