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

Feature/#220 iframe support (#315)

* Refactored Virtual DOM structure
* Added new E2E tests
* Updated E2E Test Runner
This commit is contained in:
Tim Voronov
2019-06-19 17:58:56 -04:00
committed by GitHub
parent 8c07516ed1
commit d7b923e4c3
103 changed files with 2815 additions and 1629 deletions

View File

@ -10,7 +10,7 @@ import (
)
// Input types a value to an underlying input element.
// @param source (Document | Element) - Event target.
// @param source (Open | GetElement) - Event target.
// @param valueOrSelector (String) - Selector or a value.
// @param value (String) - Target value.
// @param delay (Int, optional) - Waits delay milliseconds between keystrokes
@ -23,14 +23,18 @@ func Input(ctx context.Context, args ...core.Value) (core.Value, error) {
}
arg1 := args[0]
err = core.ValidateType(arg1, drivers.HTMLDocumentType, drivers.HTMLElementType)
err = core.ValidateType(arg1, drivers.HTMLPageType, drivers.HTMLDocumentType, drivers.HTMLElementType)
if err != nil {
return values.False, err
}
if arg1.Type() == drivers.HTMLDocumentType {
doc := arg1.(drivers.HTMLDocument)
if arg1.Type() == drivers.HTMLPageType || arg1.Type() == drivers.HTMLDocumentType {
doc, err := drivers.ToDocument(arg1)
if err != nil {
return values.False, err
}
// selector
arg2 := args[1]
@ -57,7 +61,12 @@ func Input(ctx context.Context, args ...core.Value) (core.Value, error) {
return doc.InputBySelector(ctx, arg2.(values.String), args[2], delay)
}
el := arg1.(drivers.HTMLElement)
el, err := drivers.ToElement(arg1)
if err != nil {
return values.None, err
}
delay := values.Int(0)
if len(args) == 3 {