|
10 | 10 | from lumen.state import state |
11 | 11 | from lumen.variables.base import Variables |
12 | 12 | from lumen.views.base import ( |
13 | | - Panel, VegaLiteView, View, hvOverlayView, hvPlotView, |
| 13 | + Panel, Table, VegaLiteView, View, hvOverlayView, hvPlotView, |
14 | 14 | ) |
15 | 15 |
|
16 | 16 |
|
@@ -221,6 +221,29 @@ def test_hvplot_view_to_spec(set_root): |
221 | 221 | 'alpha': 0.3 |
222 | 222 | } |
223 | 223 |
|
| 224 | +def test_table_layout_defaults(set_root): |
| 225 | + set_root(str(Path(__file__).parent.parent)) |
| 226 | + source = FileSource(tables={'test': 'sources/test.csv'}) |
| 227 | + view = View.from_spec({'type': 'table', 'table': 'test'}, source, []) |
| 228 | + panel = view.get_panel() |
| 229 | + assert panel.sizing_mode == 'stretch_width' |
| 230 | + assert panel.layout == 'fit_data_stretch' |
| 231 | + assert panel._configuration.get('columnDefaults', {}).get('maxInitialWidth') == 300 |
| 232 | + |
| 233 | + |
| 234 | +def test_table_user_configuration_merges(set_root): |
| 235 | + set_root(str(Path(__file__).parent.parent)) |
| 236 | + source = FileSource(tables={'test': 'sources/test.csv'}) |
| 237 | + table = Table( |
| 238 | + pipeline=Pipeline(source=source, table='test'), |
| 239 | + configuration={'columnDefaults': {'maxInitialWidth': 500, 'headerSort': False}}, |
| 240 | + ) |
| 241 | + panel = table.get_panel() |
| 242 | + config = panel._configuration |
| 243 | + assert config['columnDefaults']['maxInitialWidth'] == 500 |
| 244 | + assert config['columnDefaults']['headerSort'] is False |
| 245 | + |
| 246 | + |
224 | 247 | @pytest.mark.parametrize("view_type", ("table", "hvplot")) |
225 | 248 | def test_view_title(set_root, view_type): |
226 | 249 | set_root(str(Path(__file__).parent.parent)) |
|
0 commit comments