Skip to content

Commit 26c2151

Browse files
pragam-m25pragam-m25pre-commit-ci[bot]
authored
Tests: Add test for InputText in UserInputs (#2870)
* Tests: Add tests for Checkbox and InputText in UserInputs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix: Remove typo in comment for codespell * Refactor: Move InputText test to test_solara_viz_updated.py as per review * Fix: Correctly place test method inside TestMakeUserInput class --------- Co-authored-by: pragam-m25 <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 115fb29 commit 26c2151

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_solara_viz_updated.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,24 @@ def Test(user_params):
9393
assert slider_int.max is None
9494
assert slider_int.step is None
9595

96+
def test_input_text_field(self):
97+
"""Test that "InputText" type creates a vw.TextField."""
98+
99+
@solara.component
100+
def Test(user_params):
101+
UserInputs(user_params)
102+
103+
options = {"type": "InputText", "value": "JohnDoe", "label": "Agent Name"}
104+
105+
user_params = {"agent_name": options}
106+
107+
_, rc = solara.render(Test(user_params), handle_error=False)
108+
109+
textfield = rc.find(vw.TextField).widget
110+
111+
assert textfield.v_model == options["value"]
112+
assert textfield.label == options["label"]
113+
96114

97115
def test_call_space_drawer(mocker):
98116
"""Test the call to space drawer."""

0 commit comments

Comments
 (0)