mercredi 12 octobre 2016

Is JS enabled when testing with Laravel?

I'm using Laravel tests to test a form.

I'm trying to use $this->select('value','selectName') to set an option on a select, but this selects is populated on the page with the following script:

<script>
    for(var i = 1940; i < 2020; i++){
         document.write('<option value="'+i+'">'+i+'</option>');
    }
</script>

But when I run the test, I get :

InvalidArgumentException: Input "year" cannot take "1992" as a value (possible values: ).

When I just make the options with html tags however, everything runs fine, so I'm guessing JS is not enabled or runs after the parsing.

Is this expected behaviour? What can I do to test it with JS enabled?

Aucun commentaire:

Enregistrer un commentaire