mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Use send_keys to populate tom select input
Setting the value directly doesn't trigger the search, presumably because it doesn't trigger any javascript event.
This commit is contained in:
committed by
Gaetan Craig-Riou
parent
cd9c505c6b
commit
270a310e0f
@@ -100,8 +100,8 @@ module WebHelper
|
||||
def tomselect_search_and_select(value, options)
|
||||
tomselect_wrapper = page.find("[name='#{options[:from]}']").sibling(".ts-wrapper")
|
||||
tomselect_wrapper.find(".ts-control").click
|
||||
tomselect_wrapper.find(:css, '.ts-dropdown input.dropdown-input').set(value)
|
||||
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
|
||||
end
|
||||
|
||||
|
||||
@@ -1074,19 +1074,18 @@ describe '
|
||||
end
|
||||
|
||||
describe "searching customers" do
|
||||
def serching_for_customers
|
||||
def searching_for_customers
|
||||
# opens the customer dropdown
|
||||
find(".items-placeholder").click
|
||||
|
||||
# sets the query name
|
||||
find(".dropdown-input").set("John")
|
||||
find(".dropdown-input").send_keys("John")
|
||||
within(".customer-details") do
|
||||
expect(page).to have_content("John Doe")
|
||||
expect(page).to have_content(customer.email.to_s)
|
||||
end
|
||||
|
||||
# sets the query email
|
||||
find(".dropdown-input").set("maura@smith.biz")
|
||||
find(".dropdown-input").send_keys("maura@smith.biz")
|
||||
within(".customer-details") do
|
||||
expect(page).to have_content("John Doe")
|
||||
expect(page).to have_content(customer.email.to_s)
|
||||
@@ -1103,7 +1102,7 @@ describe '
|
||||
end
|
||||
|
||||
it "finds a customer by name" do
|
||||
serching_for_customers
|
||||
searching_for_customers
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1117,7 +1116,7 @@ describe '
|
||||
end
|
||||
|
||||
it "finds a customer by name" do
|
||||
serching_for_customers
|
||||
searching_for_customers
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user