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

Method FindText

testing.go:83–103  ·  view source on GitHub ↗

FindText returns the nth Text node's value (depth-first).

(n int)

Source from the content-addressed store, hash-verified

81
82// FindText returns the nth Text node's value (depth-first).
83func (rt *RenderedTree) FindText(n int) TextResult {
84 count := 0
85 var result TextResult
86 walkNodes(rt.root, func(node *viewNode) bool {
87 if node.kind == viewKindText && node.text != nil {
88 if count == n {
89 switch tc := node.text.content.(type) {
90 case staticText:
91 result.Value = string(tc)
92 case reactiveText:
93 result.Value = tc.signal.Value()
94 }
95 result.found = true
96 return false
97 }
98 count++
99 }
100 return true
101 })
102 return result
103}
104
105// FindButton returns the nth Button node (depth-first).
106func (rt *RenderedTree) FindButton(n int) ButtonResult {

Callers 5

TestTestRenderCounterFunction · 0.80
TestTestRenderToggleFunction · 0.80
TestTestRenderTextFieldFunction · 0.80
TestTestRenderWithStoreFunction · 0.80

Calls 2

walkNodesFunction · 0.85
ValueMethod · 0.65

Tested by 5

TestTestRenderCounterFunction · 0.64
TestTestRenderToggleFunction · 0.64
TestTestRenderTextFieldFunction · 0.64
TestTestRenderWithStoreFunction · 0.64