From 5034d6323ee19d919fac8b05dc9e75f640263ea3 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Tue, 14 Jan 2025 18:34:40 +0100 Subject: [PATCH] Fix TextAreaInput --- src/panel_material_ui/widgets/TextArea.jsx | 12 ++++++------ tests/ui/widgets/test_input.py | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/panel_material_ui/widgets/TextArea.jsx b/src/panel_material_ui/widgets/TextArea.jsx index 2e91c65..a34630e 100644 --- a/src/panel_material_ui/widgets/TextArea.jsx +++ b/src/panel_material_ui/widgets/TextArea.jsx @@ -22,14 +22,13 @@ export function render({model}) { return ( setValue(value_input)} onChange={(event) => setValueInput(event.target.value)} onKeyDown={(event) => { @@ -37,8 +36,9 @@ export function render({model}) { setValue(value_input) } }} - maxRows={max_rows} - fullWidth + placeholder={placeholder} + value={value_input} + variant={variant} {...props} /> ) diff --git a/tests/ui/widgets/test_input.py b/tests/ui/widgets/test_input.py index e2b9fc0..34ecc4a 100644 --- a/tests/ui/widgets/test_input.py +++ b/tests/ui/widgets/test_input.py @@ -5,7 +5,7 @@ from panel_material_ui.widgets import TextInput, PasswordInput, TextAreaInput, Checkbox, Switch, FileInput, ToggleIcon from playwright.sync_api import expect -from tests.util import serve_component +from tests.util import serve_component, wait_until pytestmark = pytest.mark.ui @@ -55,7 +55,7 @@ def test_text_area_auto_grow(page): input_area.press('Enter') # 8 rows - assert input_area.bounding_box()['height'] == 8 * TEXTAREA_LINE_HEIGHT + wait_until(lambda: input_area.bounding_box()['height'] == 8 * TEXTAREA_LINE_HEIGHT, page) def test_text_area_auto_grow_max_rows(page): @@ -68,8 +68,8 @@ def test_text_area_auto_grow_max_rows(page): input_area.press('Enter') input_area.press('Enter') input_area.press('Enter') - # 7 rows - assert input_area.bounding_box()['height'] == 7 * TEXTAREA_LINE_HEIGHT + + wait_until(lambda: input_area.bounding_box()['height'] == 7 * TEXTAREA_LINE_HEIGHT, page) def test_text_area_auto_grow_min_rows(page): @@ -83,7 +83,7 @@ def test_text_area_auto_grow_min_rows(page): for _ in range(10): input_area.press('Backspace') - assert input_area.bounding_box()['height'] == 3 * TEXTAREA_LINE_HEIGHT + wait_until(lambda: input_area.bounding_box()['height'] == 3 * TEXTAREA_LINE_HEIGHT, page) def test_text_area_auto_grow_shrink_back_on_new_value(page):