Test that a stateful component is created correctly. Args: test_state: A test state.
(test_state)
| 613 | |
| 614 | |
| 615 | def test_stateful_component(test_state): |
| 616 | """Test that a stateful component is created correctly. |
| 617 | |
| 618 | Args: |
| 619 | test_state: A test state. |
| 620 | """ |
| 621 | text_component = xt.text(test_state.num) |
| 622 | stateful_component = StatefulComponent.compile_from(text_component) |
| 623 | assert isinstance(stateful_component, StatefulComponent) |
| 624 | assert stateful_component.tag is not None |
| 625 | assert stateful_component.tag.startswith("Text_") |
| 626 | assert stateful_component.references == 1 |
| 627 | sc2 = StatefulComponent.compile_from(xt.text(test_state.num)) |
| 628 | assert isinstance(sc2, StatefulComponent) |
| 629 | assert stateful_component.references == 2 |
| 630 | assert sc2.references == 2 |
| 631 | |
| 632 | |
| 633 | def test_stateful_component_memoize_event_trigger(test_state): |
nothing calls this directly
no test coverage detected