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:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user