Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser.php
Show First 20 Lines • Show All 223 Lines • ▼ Show 20 Lines | public function removeDownloadedFile($filename) | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | /** | ||||
* Clears the input field and related vue v-model data. | * Clears the input field and related vue v-model data. | ||||
*/ | */ | ||||
public function vueClear($selector) | public function vueClear($selector) | ||||
{ | { | ||||
if ($this->resolver->prefix != 'body') { | $selector = $this->resolver->format($selector); | ||||
$selector = $this->resolver->prefix . ' ' . $selector; | |||||
} | |||||
// The existing clear(), and type() with empty string do not work. | // The existing clear(), and type() with empty string do not work. | ||||
// We have to clear the field and dispatch 'input' event programatically. | // We have to clear the field and dispatch 'input' event programatically. | ||||
$this->script( | $this->script( | ||||
"var element = document.querySelector('$selector');" | "var element = document.querySelector('$selector');" | ||||
. "element.value = '';" | . "element.value = '';" | ||||
. "element.dispatchEvent(new Event('input'))" | . "element.dispatchEvent(new Event('input'))" | ||||
Show All 25 Lines |