Phosphor::NotificationMock
Inherits Phosphor::MockWidget < Reference < Object
A transient message that self-dismisses after a configurable number of
Cmd::Tick events — a toast/banner overlay.
Generic and app-agnostic: no knowledge of AppState, Msg, or the
application theme. The Widget wrapper resolves theme → Style values
and sets them in Props before each render.
Owns no timer: it only advances state.ticks_remaining in response to
Cmd::Tick. The consuming screen mounts a TickPort in on_mount; the
wrapping Widget translates each TickEvent it receives into a
Cmd::Tick for this mock's handle_cmd. When the countdown reaches
zero, handle_cmd returns CmdResult::Bubble so the owning Widget can
emit a dismissal Msg for the Screen to act on. See
.claude/rules/async.md.
Constructors
Initialises the notification with props and an optional state.
Instance methods
Responds to Cmd::Tick by decrementing state.ticks_remaining.
Returns CmdResult::Bubble once it reaches 0, so the owning
Widget can emit a dismissal Msg; otherwise returns
CmdResult::None. Any other command also returns CmdResult::None.
Writes props.message centered horizontally on a single row at
frame.y, clipped to frame.width.
Narrows the inherited state getter to NotificationMock::WidgetState.
Safe: initialize only ever stores a WidgetState into the base
@state ivar.