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")