mockdom

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DOMOperation

type DOMOperation struct {
	Type      string
	NodeID    int
	ParentID  int
	Data      interface{}
	Timestamp time.Time
}

DOMOperation records a DOM operation for testing

type MockDOMAdapter

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

MockDOMAdapter implements runtime.DOMAdapter

func NewMockDOMAdapter

func NewMockDOMAdapter() *MockDOMAdapter

func (*MockDOMAdapter) AppendChild

func (a *MockDOMAdapter) AppendChild(parent, child runtime.DOMNode)

func (*MockDOMAdapter) AssertOperation

func (a *MockDOMAdapter) AssertOperation(index int, expectedType string) error

func (*MockDOMAdapter) ClearOperations

func (a *MockDOMAdapter) ClearOperations()

func (*MockDOMAdapter) CreateElement

func (a *MockDOMAdapter) CreateElement(tag string) runtime.DOMNode

func (*MockDOMAdapter) CreateTextNode

func (a *MockDOMAdapter) CreateTextNode(text string) runtime.DOMNode

func (*MockDOMAdapter) GetChildren

func (a *MockDOMAdapter) GetChildren(node runtime.DOMNode) []runtime.DOMNode

func (*MockDOMAdapter) GetFirstChild

func (a *MockDOMAdapter) GetFirstChild(node runtime.DOMNode) runtime.DOMNode

func (*MockDOMAdapter) GetNextSibling

func (a *MockDOMAdapter) GetNextSibling(node runtime.DOMNode) runtime.DOMNode

func (*MockDOMAdapter) GetNode

func (a *MockDOMAdapter) GetNode(id int) *MockDOMNode

func (*MockDOMAdapter) GetOperations

func (a *MockDOMAdapter) GetOperations() []DOMOperation

Helper methods for testing

func (*MockDOMAdapter) GetParent

func (a *MockDOMAdapter) GetParent(node runtime.DOMNode) runtime.DOMNode

func (*MockDOMAdapter) GetProperty

func (a *MockDOMAdapter) GetProperty(node runtime.DOMNode, name string) interface{}

func (*MockDOMAdapter) InsertBefore

func (a *MockDOMAdapter) InsertBefore(parent, newNode, referenceNode runtime.DOMNode)

func (*MockDOMAdapter) RemoveAttribute

func (a *MockDOMAdapter) RemoveAttribute(node runtime.DOMNode, name string)

func (*MockDOMAdapter) RemoveChild

func (a *MockDOMAdapter) RemoveChild(parent, child runtime.DOMNode)

func (*MockDOMAdapter) ReplaceChild

func (a *MockDOMAdapter) ReplaceChild(parent, newNode, oldNode runtime.DOMNode)

func (*MockDOMAdapter) SetAttribute

func (a *MockDOMAdapter) SetAttribute(node runtime.DOMNode, name, value string)

func (*MockDOMAdapter) SetInnerHTML

func (a *MockDOMAdapter) SetInnerHTML(node runtime.DOMNode, html string)

func (*MockDOMAdapter) SetProperty

func (a *MockDOMAdapter) SetProperty(node runtime.DOMNode, name string, value interface{})

func (*MockDOMAdapter) SetStyle

func (a *MockDOMAdapter) SetStyle(node runtime.DOMNode, property, value string)

func (*MockDOMAdapter) SetStyles

func (a *MockDOMAdapter) SetStyles(node runtime.DOMNode, styles map[string]string)

func (*MockDOMAdapter) SetTextContent

func (a *MockDOMAdapter) SetTextContent(node runtime.DOMNode, text string)

func (*MockDOMAdapter) WrapFunction

func (a *MockDOMAdapter) WrapFunction(fn interface{}) interface{}

type MockDOMNode

type MockDOMNode struct {
	ID          int
	Tag         string
	TextContent string
	Attrs       map[string]string
	Props       map[string]interface{}
	Styles      map[string]string
	InnerHTML   string
	Children    []*MockDOMNode
	Parent      *MockDOMNode
}

MockDOMNode implements runtime.DOMNode

func (*MockDOMNode) Equals

func (n *MockDOMNode) Equals(other runtime.DOMNode) bool

func (*MockDOMNode) IsNull

func (n *MockDOMNode) IsNull() bool

type MockDeadline

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

MockDeadline implements runtime.Deadline

func (*MockDeadline) DidTimeout

func (d *MockDeadline) DidTimeout() bool

func (*MockDeadline) TimeRemaining

func (d *MockDeadline) TimeRemaining() float64

type MockScheduler

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

MockScheduler implements runtime.Scheduler for testing

func NewMockScheduler

func NewMockScheduler(synchronous bool) *MockScheduler

func (*MockScheduler) FlushIdleCallbacks

func (s *MockScheduler) FlushIdleCallbacks()

FlushIdleCallbacks executes all pending idle callbacks

func (*MockScheduler) FlushTimeouts

func (s *MockScheduler) FlushTimeouts()

FlushTimeouts executes all pending timeouts

func (*MockScheduler) GetPendingCount

func (s *MockScheduler) GetPendingCount() int

GetPendingCount returns the number of pending callbacks

func (*MockScheduler) RequestIdleCallback

func (s *MockScheduler) RequestIdleCallback(callback func(deadline runtime.Deadline))

func (*MockScheduler) SetTimeout

func (s *MockScheduler) SetTimeout(callback func(), delay int)

Jump to

Keyboard shortcuts

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