diff --git a/element_test.go b/element_test.go index e55e977c..5b91041e 100644 --- a/element_test.go +++ b/element_test.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/json" "errors" + "fmt" "image/color" "image/png" "os" @@ -11,13 +12,14 @@ import ( "testing" "time" + "github.com/ysmood/gson" + "github.com/go-rod/rod" "github.com/go-rod/rod/lib/cdp" "github.com/go-rod/rod/lib/devices" "github.com/go-rod/rod/lib/input" "github.com/go-rod/rod/lib/proto" "github.com/go-rod/rod/lib/utils" - "github.com/ysmood/gson" ) func TestGetElementPage(t *testing.T) { @@ -325,6 +327,22 @@ func TestInputTime(t *testing.T) { g.True(p.MustHas("[event=input-datetime-local-change]")) } + { + el = p.MustElement("[type=time]") + el.MustInputTime(now) + + g.Eq(el.MustText(), fmt.Sprintf("%d:%d", now.Hour(), now.Minute())) + g.True(p.MustHas("[event=input-time-change]")) + } + + { + el = p.MustElement("[type=month]") + el.MustInputTime(now) + + g.Eq(el.MustText(), now.Format("2006-01")) + g.True(p.MustHas("[event=input-month-change]")) + } + g.Panic(func() { g.mc.stubErr(1, proto.RuntimeCallFunctionOn{}) el.MustInputTime(now) diff --git a/fixtures/input.html b/fixtures/input.html index 33970cae..6c08aaf2 100644 --- a/fixtures/input.html +++ b/fixtures/input.html @@ -25,6 +25,20 @@
+ + +
+ + + +
+