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

Method FindToggle

testing.go:142–160  ·  view source on GitHub ↗

FindToggle returns the nth Toggle node (depth-first).

(n int)

Source from the content-addressed store, hash-verified

140
141// FindToggle returns the nth Toggle node (depth-first).
142func (rt *RenderedTree) FindToggle(n int) ToggleResult {
143 count := 0
144 var result ToggleResult
145 walkNodes(rt.root, func(node *viewNode) bool {
146 if node.kind == viewKindToggle && node.toggle != nil {
147 if count == n {
148 result.Label = node.toggle.label
149 result.Checked = node.toggle.checked
150 result.onChange = node.toggle.onChange
151 result.tree = rt
152 result.found = true
153 return false
154 }
155 count++
156 }
157 return true
158 })
159 return result
160}
161
162// FindTextField returns the nth TextField node (depth-first).
163func (rt *RenderedTree) FindTextField(n int) TextFieldResult {

Callers 1

TestTestRenderToggleFunction · 0.80

Calls 1

walkNodesFunction · 0.85

Tested by 1

TestTestRenderToggleFunction · 0.64