mock

package
v0.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer is a headless reference renderer for browser-less simulation and tests.

func New

func New(p view.Presenter) *Renderer

New creates a reference renderer instance for a given Presenter.

func (*Renderer) Cancel added in v0.1.7

func (r *Renderer) Cancel()

Cancel simulates the "↺" (undo) action: abandons the draft/selection and clears the tracked focus — nothing must be left focused after a cancel.

func (*Renderer) Delete

func (r *Renderer) Delete()

Delete deletes the selected record.

func (*Renderer) Deselect added in v0.1.2

func (r *Renderer) Deselect()

Deselect clears the selection and form.

func (*Renderer) Edit added in v0.1.6

func (r *Renderer) Edit(id string)

Edit simulates ⋮ → Editar: selects id then focuses the first field.

func (*Renderer) Filter added in v0.1.2

func (r *Renderer) Filter(term string) []string

Filter filters the presenter items and returns their labels.

func (*Renderer) FocusedFieldID added in v0.1.6

func (r *Renderer) FocusedFieldID() string

FocusedFieldID returns the field name New()/Edit() last targeted.

func (*Renderer) Labels

func (r *Renderer) Labels() []string

Labels returns labels of the loaded items.

func (*Renderer) Mount

func (r *Renderer) Mount()

Mount triggers loading data into the presenter synchronously.

func (*Renderer) New added in v0.1.6

func (r *Renderer) New()

New simulates the "+" (create new) action: clears the selection/form and focuses the first field, same as a real renderer would.

func (*Renderer) Presenter

func (r *Renderer) Presenter() view.Presenter

Presenter returns the underlying presenter.

func (*Renderer) Save

func (r *Renderer) Save()

Save synchronizes the headless form values with the Record, and calls Save — but only when something actually changed since the last load/save (see isDirty). A commit that touches nothing (e.g. focus moved through a field and back) must never reach the Saver: it isn't a save, it's a no-op.

func (*Renderer) Select

func (r *Renderer) Select(id string)

Select marks id as selected, and populates r.form with the record's schema fields.

func (*Renderer) SetField

func (r *Renderer) SetField(name, value string)

SetField sets a form field value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL