1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-07-03 00:46:51 +02:00

Added scroll options (#471)

* Added scroll options

* Updated dependencies

* Updates after code review

* Updates after review

* Added comments
This commit is contained in:
Tim Voronov
2020-04-25 15:06:00 -04:00
committed by GitHub
parent 64fc010e6e
commit c9dfb79641
13 changed files with 419 additions and 100 deletions

View File

@ -105,3 +105,35 @@ func waitTimeout(ctx context.Context, value values.Int) (context.Context, contex
time.Duration(value)*time.Millisecond,
)
}
func toScrollOptions(value core.Value) (drivers.ScrollOptions, error) {
result := drivers.ScrollOptions{}
err := core.ValidateType(value, types.Object)
if err != nil {
return result, err
}
obj := value.(*values.Object)
behavior, exists := obj.Get("behavior")
if exists {
result.Behavior = drivers.NewScrollBehavior(behavior.String())
}
block, exists := obj.Get("block")
if exists {
result.Block = drivers.NewScrollVerticalAlignment(block.String())
}
inline, exists := obj.Get("inline")
if exists {
result.Inline = drivers.NewScrollHorizontalAlignment(inline.String())
}
return result, nil
}