Skip to content

Commit

Permalink
Fix TextAreaInput
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Jan 14, 2025
1 parent 9cc52ca commit 5034d63
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/panel_material_ui/widgets/TextArea.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ export function render({model}) {

return (
<TextField
fullWidth
multiline
color={color}
disabled={disabled}
error={error_state}
label={label}
placeholder={placeholder}
variant={variant}
value={value}
disabled={disabled}
maxRows={max_rows}
onBlur={() => setValue(value_input)}
onChange={(event) => setValueInput(event.target.value)}
onKeyDown={(event) => {
if (event.key === "Enter") {
setValue(value_input)
}
}}
maxRows={max_rows}
fullWidth
placeholder={placeholder}
value={value_input}
variant={variant}
{...props}
/>
)
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/widgets/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand Down

0 comments on commit 5034d63

Please sign in to comment.