def test_script_event_handler():
    """Test event handlers are rendered as expected."""
    component = Script.create(
        src="foo.js",
        on_ready=EvState.on_ready,
        on_load=EvState.on_load,
        on_error=EvState.on_error,
    )
    render_dict = component.render()
    assert (
        f'onReady:((...args) => (addEvents([(Event("{EvState.get_full_name()}.on_ready", ({{  }}), ({{  }})))], args, ({{  }}))))'
        in render_dict["props"]
    )
    assert (
        f'onLoad:((...args) => (addEvents([(Event("{EvState.get_full_name()}.on_load", ({{  }}), ({{  }})))], args, ({{  }}))))'
        in render_dict["props"]
    )
    assert (
        f'onError:((...args) => (addEvents([(Event("{EvState.get_full_name()}.on_error", ({{  }}), ({{  }})))], args, ({{  }}))))'
        in render_dict["props"]
    )
Test event handlers are rendered as expected.
tests/units/components/base/test_script.py