I can bind checkbox
This commit is contained in:
@@ -6,7 +6,7 @@ from fasthtml.components import Input, Label
|
||||
from fasthtml.fastapp import fast_app
|
||||
|
||||
from myfasthtml.controls.helpers import mk
|
||||
from myfasthtml.core.bindings import Binding, DetectionMode, UpdateMode, BooleanConverter
|
||||
from myfasthtml.core.bindings import Binding
|
||||
from myfasthtml.core.commands import Command, CommandsManager
|
||||
from myfasthtml.test.testclient import MyTestClient, TestableElement
|
||||
|
||||
@@ -78,24 +78,3 @@ class TestingBindings:
|
||||
testable_input = user.find_element("input")
|
||||
testable_input.send("new value")
|
||||
user.should_see("new value") # the one from the label
|
||||
|
||||
def test_i_can_bind_checkbox(self, user, rt):
|
||||
@rt("/")
|
||||
def index():
|
||||
data = Data(True)
|
||||
input_elt = Input(name="input_name", type="checkbox")
|
||||
label_elt = Label()
|
||||
mk.manage_binding(input_elt, Binding(data))
|
||||
mk.manage_binding(label_elt, Binding(data))
|
||||
return input_elt, label_elt
|
||||
|
||||
user.open("/")
|
||||
user.should_see("")
|
||||
testable_input = user.find_element("input")
|
||||
|
||||
testable_input.check()
|
||||
user.should_see("true")
|
||||
|
||||
testable_input.uncheck()
|
||||
user.should_see("false")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user