From ea30bf80bf9975ab28fdaffb7f05311a3b8ebf93 Mon Sep 17 00:00:00 2001 From: Dominik Klein Date: Wed, 21 Jul 2021 18:12:41 +0200 Subject: [PATCH] Fixes #3668 - The defined ignored attributes in the popover context are not working. --- .../_single_object_popover_provider.coffee | 3 ++- spec/support/capybara/common_actions.rb | 13 +++++++++++++ spec/system/user/profile_spec.rb | 8 ++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/lib/app_post/popover_provider/_single_object_popover_provider.coffee b/app/assets/javascripts/app/lib/app_post/popover_provider/_single_object_popover_provider.coffee index 70caa45b1..0bb7d24c7 100644 --- a/app/assets/javascripts/app/lib/app_post/popover_provider/_single_object_popover_provider.coffee +++ b/app/assets/javascripts/app/lib/app_post/popover_provider/_single_object_popover_provider.coffee @@ -25,6 +25,7 @@ class App.SingleObjectPopoverProvider extends App.PopoverProvider buildContentFor: (elem) -> id = @objectIdFor(elem) object = @constructor.klass.fullLocal(id) + ignoredAttributes = @constructor.ignoredAttributes # get display data data = _.values(@constructor.klass.attributesGet('view')) @@ -37,7 +38,7 @@ class App.SingleObjectPopoverProvider extends App.PopoverProvider # add to show if value exists # do not show ignroed attributes - object[name] && attr.shown && !_.include(@constructor.ignoredAttributes, name) + object[name] && attr.shown && !_.include(ignoredAttributes, name) @buildHtmlContent( object: object diff --git a/spec/support/capybara/common_actions.rb b/spec/support/capybara/common_actions.rb index 021aa1439..e64dfdde9 100644 --- a/spec/support/capybara/common_actions.rb +++ b/spec/support/capybara/common_actions.rb @@ -270,6 +270,19 @@ module CommonActions modal_disappear(timeout: timeout) if disappears end + + # Show the popover on hover + # + # @example + # popover_on_hover(page.find('button.hover_me')) + # + def popover_on_hover(element, wait_for_popover_killer: true) + # wait for popover killer to pass + sleep 3 if wait_for_popover_killer + + move_mouse_to(element) + move_mouse_by(5, 5) + end end RSpec.configure do |config| diff --git a/spec/system/user/profile_spec.rb b/spec/system/user/profile_spec.rb index 47fdac475..8d790b4cf 100644 --- a/spec/system/user/profile_spec.rb +++ b/spec/system/user/profile_spec.rb @@ -33,4 +33,12 @@ RSpec.describe 'User Profile', type: :system do end end end + + it 'check that ignored attributes for user popover are not visible' do + fill_in id: 'global-search', with: customer.firstname + + popover_on_hover(find('.nav-tab--search.user')) + + expect(page).to have_css('.popover label', count: 1) + end end