diff --git a/examples/spread.rs b/examples/spread.rs index dc6b7b01d..b13124a5f 100644 --- a/examples/spread.rs +++ b/examples/spread.rs @@ -20,6 +20,7 @@ fn app(cx: Scope) -> Element { } } +#[component] fn Component<'a>(cx: Scope<'a, Props<'a>>) -> Element<'a> { render! { audio { diff --git a/packages/native-core/tests/fuzzing.rs b/packages/native-core/tests/fuzzing.rs index 4f0a34b70..63376f86e 100644 --- a/packages/native-core/tests/fuzzing.rs +++ b/packages/native-core/tests/fuzzing.rs @@ -204,6 +204,20 @@ fn create_random_dynamic_node(cx: &ScopeState, depth: usize) -> DynamicNode { } } +fn create_random_dynamic_mounted_attr(cx: &ScopeState) -> MountedAttribute { + match rand::random::() % 2 { + 0 => MountedAttribute::from( + &*cx.bump().alloc( + (0..(rand::random::() % 3) as usize) + .map(|_| create_random_dynamic_attr(cx)) + .collect::>(), + ), + ), + 1 => MountedAttribute::from(create_random_dynamic_attr(cx)), + _ => unreachable!(), + } +} + fn create_random_dynamic_attr(cx: &ScopeState) -> Attribute { let value = match rand::random::() % 6 { 0 => AttributeValue::Text(Box::leak( @@ -214,7 +228,6 @@ fn create_random_dynamic_attr(cx: &ScopeState) -> Attribute { 3 => AttributeValue::Bool(rand::random()), 4 => cx.any_value(rand::random::()), 5 => AttributeValue::None, - // Listener(RefCell>>), _ => unreachable!(), }; Attribute::new( @@ -273,11 +286,14 @@ fn create_random_element(cx: Scope) -> Element { .collect(); cx.bump().alloc(dynamic_nodes) }, - dynamic_attrs: cx.bump().alloc( - (0..template.attr_paths.len()) - .map(|_| create_random_dynamic_attr(cx)) - .collect::>(), - ), + dynamic_attrs: cx + .bump() + .alloc( + (0..template.attr_paths.len()) + .map(|_| create_random_dynamic_mounted_attr(cx)) + .collect::>(), + ) + .as_slice(), }; Some(node) }