From 0f15dddf4c1ac71451d92e8f5e9d97723f54dc7c Mon Sep 17 00:00:00 2001 From: Thomas Walpole Date: Sat, 13 Apr 2024 11:40:08 -0700 Subject: [PATCH] Update isDeisplayed atom to support popover elements (#2759) * Update isDeisplayed atom to support popover elements * Add another test case --- .../selenium/atoms/isDisplayed.min.js | 2 +- .../selenium/atoms/src/isDisplayed.js | 10 ++++++++++ .../spec/session/click_button_spec.rb | 9 +++++++++ lib/capybara/spec/session/has_element_spec.rb | 3 ++- lib/capybara/spec/session/node_spec.rb | 16 +++++++++++++++ lib/capybara/spec/views/form.erb | 6 ++++++ lib/capybara/spec/views/with_html.erb | 20 +++++++++++++++++++ spec/dsl_spec.rb | 2 ++ spec/rack_test_spec.rb | 2 ++ spec/selenium_spec_firefox.rb | 2 ++ 10 files changed, 70 insertions(+), 2 deletions(-) diff --git a/lib/capybara/selenium/atoms/isDisplayed.min.js b/lib/capybara/selenium/atoms/isDisplayed.min.js index 5b89d2140..318760712 100644 --- a/lib/capybara/selenium/atoms/isDisplayed.min.js +++ b/lib/capybara/selenium/atoms/isDisplayed.min.js @@ -1 +1 @@ -(function(){function d(t,e,n){function r(t){var e=x(t);if(0=s.left+s.width,m=o.top>=s.top+s.height;if(N&&"hidden"==h.x||m&&"hidden"==h.y)return T.HIDDEN;if(N&&"visible"!=h.x||m&&"visible"!=h.y){if(i){var y=r(f);if(o.left>=u.scrollWidth-y.x||o.right>=u.scrollHeight-y.y)return T.HIDDEN}return C(f)==T.HIDDEN?T.HIDDEN:T.SCROLL}}}return T.NONE}function o(t){var e=t.document.documentElement;return{width:e.clientWidth,height:e.clientHeight}}function p(t,e,n,r){return{left:t,top:e,width:n,height:r}}function x(t){var e,n=s(t);if(n)return n.rect;if("HTML"==t.tagName.toUpperCase()){t.ownerDocument;var r=o(window);return p(0,0,r.width,r.height)}try{e=t.getBoundingClientRect()}catch(i){return p(0,0,0,0)}return p(e.left,e.top,e.right-e.left,e.bottom-e.top)}function f(t){var e=1,n=window.getComputedStyle(t).opacity;n&&(e=Number(n));var r=D(t);return r&&r.nodeType==Node.ELEMENT_NODE&&(e*=f(r)),e}function h(t){var e=t.shape.toLowerCase(),n=t.coords.split(",");if("rect"==e&&4==n.length){var r=n[0],i=n[1];return p(r,i,n[2]-r,n[3]-i)}if("circle"==e&&3==n.length){var o=n[0],a=n[1],u=n[2];return p(o-u,a-u,2*u,2*u)}if("poly"==e&&2=s.left+s.width,N=o.top>=s.top+s.height;if(w&&"hidden"==h.x||N&&"hidden"==h.y)return T.HIDDEN;if(w&&"visible"!=h.x||N&&"visible"!=h.y){if(i){var y=n(f);if(o.left>=u.scrollWidth-y.x||o.right>=u.scrollHeight-y.y)return T.HIDDEN}return C(f)==T.HIDDEN?T.HIDDEN:T.SCROLL}}}return T.NONE}function o(t){var e=t.document.documentElement;return{width:e.clientWidth,height:e.clientHeight}}function p(t,e,r,n){return{left:t,top:e,width:r,height:n}}function x(t){var e,r=s(t);if(r)return r.rect;if("HTML"==t.tagName.toUpperCase()){t.ownerDocument;var n=o(window);return p(0,0,n.width,n.height)}try{e=t.getBoundingClientRect()}catch(i){return p(0,0,0,0)}return p(e.left,e.top,e.right-e.left,e.bottom-e.top)}function f(t){var e=1,r=window.getComputedStyle(t).opacity;r&&(e=Number(r));var n=D(t);return n&&n.nodeType==Node.ELEMENT_NODE&&(e*=f(n)),e}function h(t){var e=t.shape.toLowerCase(),r=t.coords.split(",");if("rect"==e&&4==r.length){var n=r[0],i=r[1];return p(n,i,r[2]-n,r[3]-i)}if("circle"==e&&3==r.length){var o=r[0],a=r[1],u=r[2];return p(o-u,a-u,2*u,2*u)}if("poly"==e&&2

+

+

+ + +
+