First implementation of bindings
This commit is contained in:
36
tests/testclient/test_testable_textarea.py
Normal file
36
tests/testclient/test_testable_textarea.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
import pytest
|
||||
from fasthtml.fastapp import fast_app
|
||||
|
||||
from myfasthtml.test.testclient import MyTestClient, TestableTextarea
|
||||
|
||||
|
||||
@dataclass
|
||||
class Data:
|
||||
value: str = "hello world"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def test_app():
|
||||
test_app, rt = fast_app(default_hdrs=False)
|
||||
return test_app
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def rt(test_app):
|
||||
return test_app.route
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def test_client(test_app):
|
||||
return MyTestClient(test_app)
|
||||
|
||||
|
||||
def test_i_can_read_input(test_client):
|
||||
html = '''<textarea name="textarea_name">Lorem ipsum</textarea>'''
|
||||
|
||||
input_elt = TestableTextarea(test_client, html)
|
||||
|
||||
assert input_elt.name == "textarea_name"
|
||||
assert input_elt.value == "Lorem ipsum"
|
||||
Reference in New Issue
Block a user