Unset the assignee field using the x marker

We no longer have an empty option in the user autocompleter,
but a clear button
pull/10996/head
Oliver Günther 2 years ago
parent c0c9de7eaa
commit c5ededb791
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 4
      spec/features/work_packages/edit_work_package_spec.rb
  2. 6
      spec/support/components/autocompleter/ng_select_autocomplete_helpers.rb
  3. 5
      spec/support/edit_fields/edit_field.rb

@ -168,7 +168,9 @@ describe 'edit work package',
wp_page.expect_attributes assignee: manager.name wp_page.expect_attributes assignee: manager.name
wp_page.expect_activity_message("Assignee set to #{manager.name}") wp_page.expect_activity_message("Assignee set to #{manager.name}")
wp_page.update_attributes assignee: '-' field = wp_page.edit_field :assignee
field.unset_value
wp_page.expect_attributes assignee: '-' wp_page.expect_attributes assignee: '-'
wp_page.visit! wp_page.visit!

@ -56,6 +56,12 @@ module Components::Autocompleter
from_element.find('.ng-input input') from_element.find('.ng-input input')
end end
##
# clear the ng select field
def ng_select_clear(from_element)
from_element.find('.ng-clear-wrapper', visible: :all).click
end
def select_autocomplete(element, query:, select_text: nil, results_selector: nil, wait_dropdown_open: true) def select_autocomplete(element, query:, select_text: nil, results_selector: nil, wait_dropdown_open: true)
target_dropdown = search_autocomplete(element, target_dropdown = search_autocomplete(element,
query:, query:,

@ -164,14 +164,15 @@ class EditField
## ##
# Set or select the given value. # Set or select the given value.
# For fields of type select, will check for an option with that value. # For fields of type select, will check for an option with that value.
def unset_value(content, multi = false) def unset_value(content = nil, multi = false)
activate!
scroll_to_element(input_element) scroll_to_element(input_element)
if field_type.end_with?('-autocompleter') if field_type.end_with?('-autocompleter')
if multi if multi
page.find('.ng-value-label', visible: :all, text: content).sibling('.ng-value-icon').click page.find('.ng-value-label', visible: :all, text: content).sibling('.ng-value-icon').click
else else
page.find('.ng-dropdown-panel .ng-option', visible: :all, text: '-').click ng_select_clear(field_container)
end end
else else
input_element.set('') input_element.set('')

Loading…
Cancel
Save