MCPcopy
hub / github.com/go-rod/rod / TestInput

Function TestInput

input_test.go:75–113  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

73}
74
75func TestInput(t *testing.T) {
76 g := setup(t)
77
78 text := "雲の上は\nいつも晴れ"
79
80 p := g.page.MustNavigate(g.srcFile("fixtures/input.html"))
81
82 {
83 el := p.MustElement("[contenteditable=true]").MustInput(text)
84 g.Eq(text, el.MustText())
85 }
86
87 el := p.MustElement("textarea")
88 el.MustInput(text)
89
90 g.Eq(text, el.MustText())
91 g.True(p.MustHas("[event=textarea-change]"))
92
93 g.Panic(func() {
94 g.mc.stubErr(1, proto.RuntimeCallFunctionOn{})
95 el.MustText()
96 })
97 g.Panic(func() {
98 g.mc.stubErr(4, proto.RuntimeCallFunctionOn{})
99 el.MustInput("")
100 })
101 g.Panic(func() {
102 g.mc.stubErr(5, proto.RuntimeCallFunctionOn{})
103 el.MustInput("")
104 })
105 g.Panic(func() {
106 g.mc.stubErr(6, proto.RuntimeCallFunctionOn{})
107 el.MustInput("")
108 })
109 g.Panic(func() {
110 g.mc.stubErr(1, proto.InputInsertText{})
111 el.MustInput("")
112 })
113}
114
115func TestMouse(t *testing.T) {
116 g := setup(t)

Callers

nothing calls this directly

Calls 8

setupFunction · 0.85
MustNavigateMethod · 0.80
srcFileMethod · 0.80
MustInputMethod · 0.80
MustTextMethod · 0.80
stubErrMethod · 0.80
MustElementMethod · 0.45
MustHasMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…