Documentation
¶
Index ¶
- func Run(t *testing.T, f Factory)
- type Driver
- type Factory
- type FakeCall
- type FakeCaller
- type MockList
- type MockRecord
- func (m *MockRecord) DecodeFields(r model.FieldReader)
- func (m *MockRecord) EncodeFields(w model.FieldWriter)
- func (m *MockRecord) IsNil() bool
- func (m *MockRecord) Item() view.Item
- func (m *MockRecord) ModelName() string
- func (m *MockRecord) Pointers() []any
- func (m *MockRecord) Schema() []model.Field
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Driver ¶
type Driver struct {
Mount func() // triggers initialization: renderer loads list
Labels func() []string // what the list shows right now
Select func(id string) // simulates picking a row with that id
SetField func(name, value string) // sets a form field
Save func() // simulates the save action
Delete func() // simulates the delete action
// New simulates the "+" (create new) action.
New func()
// Edit simulates picking ⋮ → Editar for the given id (select + unlock).
Edit func(id string)
// Cancel simulates the "↺" (undo) action — abandoning a new-record draft
// or a selected-but-unedited row, back to "+".
Cancel func()
// FocusedFieldID returns the id of the field the renderer most recently
// asked to focus (empty if none). Real focus movement is a WASM-only
// DOM side effect; this exposes the INTENT so the clauses below can
// assert it without a live DOM/browser.
FocusedFieldID func() string
}
Driver simulates user UI interaction over the renderer.
type FakeCall ¶ added in v0.1.0
FakeCall records one invocation the suite (or a consumer's module test) can inspect.
type FakeCaller ¶ added in v0.1.0
type FakeCaller struct {
Calls []FakeCall
// Reply fills `into` with canned TYPED data for op (no serialization); nil = no result.
Reply func(op string, into model.Decodable)
// Err, if set, is what every Call reports (and suppresses Reply).
Err error
}
FakeCaller is a codec-free router.Caller test double. Unlike router/mock.Caller it does NOT decode a wire response — it fills the typed target directly via Reply — so this package (and any renderer or module that imports it for tests) depends only on model and router, never a codec. That is the same discipline router/conformance keeps: the arnés of a contract must not drag in an implementation.
type MockList ¶
type MockList struct {
// contains filtered or unexported fields
}
MockList is a list holding simulation records.
func (*MockList) DecodeFields ¶
func (m *MockList) DecodeFields(r model.FieldReader)
DecodeFields implements model.Decodable.
type MockRecord ¶
MockRecord is a simulation record for conformance suite.
func (*MockRecord) DecodeFields ¶
func (m *MockRecord) DecodeFields(r model.FieldReader)
DecodeFields implements model.Decodable.
func (*MockRecord) EncodeFields ¶
func (m *MockRecord) EncodeFields(w model.FieldWriter)
EncodeFields implements model.Encodable.
func (*MockRecord) Item ¶ added in v0.1.2
func (m *MockRecord) Item() view.Item
Item implements view.Itemizer.
func (*MockRecord) ModelName ¶
func (m *MockRecord) ModelName() string
ModelName implements model.ModuleNaming.
func (*MockRecord) Pointers ¶
func (m *MockRecord) Pointers() []any
Pointers implements model.Fielder.
func (*MockRecord) Schema ¶
func (m *MockRecord) Schema() []model.Field
Schema implements model.Fielder.