MCPcopy Create free account
hub / github.com/NV404/gova / FindTextField

Method FindTextField

testing.go:163–182  ·  view source on GitHub ↗

FindTextField returns the nth TextField node (depth-first).

(n int)

Source from the content-addressed store, hash-verified

161
162// FindTextField returns the nth TextField node (depth-first).
163func (rt *RenderedTree) FindTextField(n int) TextFieldResult {
164 count := 0
165 var result TextFieldResult
166 walkNodes(rt.root, func(node *viewNode) bool {
167 if node.kind == viewKindTextField && node.textField != nil {
168 if count == n {
169 if st, ok := node.textField.state.(*StateValue[string]); ok {
170 result.state = st
171 }
172 result.Placeholder = node.textField.placeholder
173 result.tree = rt
174 result.found = true
175 return false
176 }
177 count++
178 }
179 return true
180 })
181 return result
182}
183
184// NodeCount returns the total number of nodes of the given kind.
185func (rt *RenderedTree) NodeCount(kind string) int {

Callers 1

TestTestRenderTextFieldFunction · 0.80

Calls 1

walkNodesFunction · 0.85

Tested by 1

TestTestRenderTextFieldFunction · 0.64