conformance

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, f Factory)

Run executes the full set of conformance clauses.

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 Factory

type Factory struct {
	New func(t *testing.T, p view.Presenter) Driver
}

Factory builds the renderer under test around the presenter and returns a Driver.

type FakeCall added in v0.1.0

type FakeCall struct {
	Op   string
	Args model.Encodable
}

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.

func (*FakeCaller) Call added in v0.1.0

func (c *FakeCaller) Call(op string, args model.Encodable, into model.Decodable, done func(err error))

func (*FakeCaller) Dispatch added in v0.1.0

func (c *FakeCaller) Dispatch(op string, args model.Encodable)

type MockList

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

MockList is a list holding simulation records.

func (*MockList) Append

func (m *MockList) Append() model.Fielder

Append implements model.FielderSlice.

func (*MockList) At

func (m *MockList) At(i int) model.Fielder

At implements model.FielderSlice.

func (*MockList) DecodeFields

func (m *MockList) DecodeFields(r model.FieldReader)

DecodeFields implements model.Decodable.

func (*MockList) IsNil

func (m *MockList) IsNil() bool

IsNil implements model.Model.

func (*MockList) Len

func (m *MockList) Len() int

Len implements model.FielderSlice.

func (*MockList) Pointers

func (m *MockList) Pointers() []any

Pointers implements model.Fielder.

func (*MockList) Schema

func (m *MockList) Schema() []model.Field

Schema implements model.Fielder.

type MockRecord

type MockRecord struct {
	ID   string
	Name string
}

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) IsNil

func (m *MockRecord) IsNil() bool

IsNil implements model.Model.

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.

Jump to

Keyboard shortcuts

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