MDL-69107 form_autocomplete: Rewrite item selection
authorAndrew Nicols <andrew@nicols.co.uk>
Mon, 15 Jun 2020 01:44:39 +0000 (09:44 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Tue, 15 Dec 2020 01:08:05 +0000 (09:08 +0800)
commit22a54453468ee2c6d794c1ea39d032acd1f77a9f
treee23f04f82d0b7b090431146a957c97af03355217
parentc537ed7feddad1d3b3959ac560226ac5b35be1d7
MDL-69107 form_autocomplete: Rewrite item selection

The form_autocomplete is essentially a custom element. Unfortunately the
`setValue()` function in Mink has undesired actions so it is necessary
to write our own handling for it.

The standard Mink `setValue()` function focuses the element, sets a
value, and then blurs the element. In the case of the autocomplete this
can cause the autocomplete suggestions list to be closed in some
situations. Instead of using the setValue we click, and type the value,
but do not immediately blur.
lib/amd/build/form-autocomplete.min.js
lib/amd/build/form-autocomplete.min.js.map
lib/amd/src/form-autocomplete.js
lib/behat/behat_field_manager.php
lib/behat/form_field/behat_form_autocomplete.php
lib/templates/form_autocomplete_input.mustache
lib/tests/behat/behat_forms.php