mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-27 03:46:50 -06:00
Rename component parameters that are strict-mode reserved words
Found while testing crates/engine/src/component_codegen.rs:~226 (RESERVED list used by ident at :346) Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 5.5
parent
92682728e9
commit
142676191e
@@ -43,6 +43,18 @@ fn button_set(s: &mut Session) -> (NodeId, NodeId, NodeId) {
|
||||
(set, variants[0], variants[1])
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn strict_mode_reserved_words_are_not_parameter_names() {
|
||||
let mut s = Session::new();
|
||||
let (c, title, _) = card(&mut s);
|
||||
ex(&mut s, "component.addProperty", json!({"id": c, "name": "Protected", "type": "text", "layer": title}));
|
||||
let react = code(&mut s, c, "react");
|
||||
assert!(react.contains("protectedValue"), "React renames the property:\n{react}");
|
||||
for bad in [" protected?", " protected =", "{protected}"] {
|
||||
assert!(!react.contains(bad), "reserved word used as a binding ({bad:?}):\n{react}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn components_take_their_properties_as_parameters() {
|
||||
let mut s = Session::new();
|
||||
|
||||
Reference in New Issue
Block a user