File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 3232 VdomJson ,
3333)
3434
35- EVENT_ATTRIBUTE_PATTERN = re .compile (r"^on[A-Z] " )
35+ EVENT_ATTRIBUTE_PATTERN = re .compile (r"^on\w+ " )
3636
3737VDOM_JSON_SCHEMA = {
3838 "$schema" : "http://json-schema.org/draft-07/schema" ,
Original file line number Diff line number Diff line change @@ -790,7 +790,7 @@ class VdomTypeDict(TypedDict):
790790 children : NotRequired [Sequence [ComponentType | VdomChild ]]
791791 attributes : NotRequired [VdomAttributes ]
792792 eventHandlers : NotRequired [EventHandlerDict ]
793- jsExecutables : NotRequired [JavaScript ]
793+ jsExecutables : NotRequired [JSExecutableDict ]
794794 importSource : NotRequired [ImportSourceDict ]
795795
796796
@@ -896,6 +896,7 @@ class JsonImportSource(TypedDict):
896896
897897
898898class JavaScript (str ):
899+ """A simple way of marking JavaScript code to be executed client-side"""
899900 pass
900901
901902
@@ -937,7 +938,7 @@ class EventHandlerType(Protocol):
937938"""A dict mapping between event names to their handlers"""
938939
939940JSExecutableMapping = Mapping [str , JavaScript ]
940- """A generic mapping between event names to their javascript"""
941+ """A generic mapping between attribute names to their javascript"""
941942
942943JSExecutableDict : TypeAlias = dict [str , JavaScript ]
943944"""A dict mapping between attribute names to their javascript"""
Original file line number Diff line number Diff line change @@ -194,6 +194,15 @@ def test_string_to_reactpy(case):
194194 "key" : "my-key" ,
195195 },
196196 },
197+ # 9: Includes `jsExecutables` attribue
198+ {
199+ "source" : '''<button onclick="this.innerText = 'CLICKED'">Click Me</button>''' ,
200+ "model" : {
201+ "tagName" : "button" ,
202+ "jsExecutables" : {"onclick" : "this.innerText = 'CLICKED'" },
203+ "children" : ["Click Me" ],
204+ }
205+ },
197206 ],
198207)
199208def test_string_to_reactpy_default_transforms (case ):
You can’t perform that action at this time.
0 commit comments