Trigger change even in select2 test helper to produce production-like behaviour

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2016-10-20 11:48:38 +03:00
parent bedbb7b744
commit 80ea344e42
1 changed files with 2 additions and 2 deletions

View File

@ -17,9 +17,9 @@ module Select2Helper
selector = options.fetch(:from)
if options[:multiple]
execute_script("$('#{selector}').select2('val', ['#{value}'], true);")
execute_script("$('#{selector}').select2('val', ['#{value}']).trigger('change');")
else
execute_script("$('#{selector}').select2('val', '#{value}', true);")
execute_script("$('#{selector}').select2('val', '#{value}').trigger('change');")
end
end
end