Files
MyFastHtml/tests/test_integration_commands.py
Kodjo Sossouvi 0f5fc696f0 Added icons
Updated README.md
Started test framework utils
2025-10-24 12:24:10 +02:00

27 lines
646 B
Python

from fasthtml.fastapp import fast_app
from myfasthtml.controls.button import mk_button
from myfasthtml.core.commands import Command
from myfasthtml.core.testclient import MyTestClient
def new_value(value):
return value
command = Command('test', 'TestingCommand', new_value, "this is my new value")
def test_i_can_trigger_a_command():
test_app, rt = fast_app(default_hdrs=False)
user = MyTestClient(test_app)
@rt('/')
def get(): return mk_button('button', command)
user.open("/")
user.should_see("button")
b = user.find_element("button")
b.click()
user.should_see("this is my new value")