Test that the wrapper of a custom component is correct.
()
| 463 | |
| 464 | |
| 465 | def test_custom_component_wrapper(): |
| 466 | """Test that the wrapper of a custom component is correct.""" |
| 467 | |
| 468 | @custom_component |
| 469 | def my_component(width: Var[int], color: Var[str]): |
| 470 | return xt.box( |
| 471 | width=width, |
| 472 | color=color, |
| 473 | ) |
| 474 | |
| 475 | ccomponent = my_component( |
| 476 | xt.text("child"), width=Var.create(1), color=Var.create("red") |
| 477 | ) |
| 478 | assert isinstance(ccomponent, CustomComponent) |
| 479 | assert len(ccomponent.children) == 1 |
| 480 | assert isinstance(ccomponent.children[0], xt.Text) |
| 481 | |
| 482 | component = ccomponent.get_component(ccomponent) |
| 483 | assert isinstance(component, Box) |
| 484 | |
| 485 | |
| 486 | def test_invalid_event_handler_args(component2, test_state): |
nothing calls this directly
no test coverage detected