connectapi icon indicating copy to clipboard operation
connectapi copied to clipboard

feat:`content_render()` and `content_restart()` implementations

Open toph-allen opened this issue 7 months ago • 1 comments

Intent

Add content_render(content) and content_restart(content) functions.

Approach

  • content_render() takes a piece of rendered content and triggers a render via the variants API. It returns a ContentTask object. If called on non-rendered content, raises an error.
  • content_restart() takes a piece of interactive content and sets then unsets an environment variable. If called on non-interactive content, raises an error.
  • Added a default_variant property to the Content class, an active binding that returns its default variant.
  • Added two active bindings (a.k.a. dynamic properties) to Content: is_interactive and is_rendered, both booleans that are computed from app_mode.

Added tests for all behaviors. I'm still feeling out testing this library; I feel like I'm used to more fully-specified unit tests rather than the more e2e style tests here.

toph-allen avatar Jul 15 '24 20:07 toph-allen