Added TestableInput
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import pytest
|
||||
from fasthtml.fastapp import fast_app
|
||||
|
||||
from myfasthtml.controls.button import mk_button
|
||||
from myfasthtml.controls.helpers import mk
|
||||
from myfasthtml.core.commands import Command, CommandsManager
|
||||
from myfasthtml.core.testclient import MyTestClient, TestableElement
|
||||
from myfasthtml.test.testclient import MyTestClient, TestableElement
|
||||
|
||||
|
||||
def new_value(value):
|
||||
@@ -24,7 +24,7 @@ def rt(user):
|
||||
|
||||
def test_i_can_trigger_a_command(user):
|
||||
command = Command('test', 'TestingCommand', new_value, "this is my new value")
|
||||
testable = TestableElement(user, mk_button('button', command))
|
||||
testable = TestableElement(user, mk.button('button', command))
|
||||
testable.click()
|
||||
assert user.get_content() == "this is my new value"
|
||||
|
||||
@@ -32,7 +32,7 @@ def test_i_can_trigger_a_command(user):
|
||||
def test_error_is_raised_when_command_is_not_found(user):
|
||||
command = Command('test', 'TestingCommand', new_value, "this is my new value")
|
||||
CommandsManager.reset()
|
||||
testable = TestableElement(user, mk_button('button', command))
|
||||
testable = TestableElement(user, mk.button('button', command))
|
||||
|
||||
with pytest.raises(ValueError) as exc_info:
|
||||
testable.click()
|
||||
@@ -44,7 +44,7 @@ def test_i_can_play_a_complex_scenario(user, rt):
|
||||
command = Command('test', 'TestingCommand', new_value, "this is my new value")
|
||||
|
||||
@rt('/')
|
||||
def get(): return mk_button('button', command)
|
||||
def get(): return mk.button('button', command)
|
||||
|
||||
user.open("/")
|
||||
user.should_see("button")
|
||||
|
||||
Reference in New Issue
Block a user