mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-24 01:13:21 +00:00
Select found option after search to fix spec
Selecting the tom select option in the dropdown often happened quicker than the search finished. In that case we selected the option from the list of all options and then the search would present the found option again and leave the dropdown open. This didn't cause any trouble in the past because any other action would close the dropdown again. But the new cuprite version didn't trigger the next click on the target element. It would just close the dropdown on the next click without further action. That would then break the next assertion looking for the next open dropdown, which didn't open with the click. Selecting the "active" option means that we wait for the search to finish and present an option as active. Clicking that option closes the dropdown without opening it again.
This commit is contained in:
@@ -15,7 +15,7 @@ module TomSelectHelper
|
||||
tomselect_wrapper.find(".ts-control").click
|
||||
# Use send_keys as setting the value directly doesn't trigger the search
|
||||
tomselect_wrapper.find(:css, '.ts-dropdown input.dropdown-input').send_keys(value)
|
||||
tomselect_wrapper.find(:css, '.ts-dropdown .ts-dropdown-content .option', text: value).click
|
||||
tomselect_wrapper.find(:css, '.ts-dropdown .ts-dropdown-content .option.active', text: value).click
|
||||
end
|
||||
|
||||
def tomselect_select(value, options)
|
||||
|
||||
Reference in New Issue
Block a user