Skip to content

Commit b9feb15

Browse files
committed
core dom is_visible: Mock in tests to check only for hidden to avoid unavailable offsetWidth/offsetHeight in Jest.
1 parent 6160980 commit b9feb15

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104

105105
### Fixes
106106

107+
- core dom is_visible: Mock in tests to check only for hidden to avoid unavailable offsetWidth/offsetHeight in Jest.
107108
- pat calendar, pat checklist, pat datetime-picker: Dispatch DOM events with bubbling and canceling features enabled, as real DOM events do.
108109
Fixes a problem where calendar categories did not show their initial state correctly.
109110
- pat inject: Make sure that nested pat-inject element have the correct context for target ``self``. Fixes: https://github.com/quaive/ploneintranet.prototype/issues/1164

src/setupTests.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,10 @@ window.ResizeObserver = function () {
3737
// Do not output error messages
3838
import logging from "./core/logging";
3939
logging.setLevel(50); // level: FATAL
40+
41+
// patch dom.is_visible to not rely on jest-unavailable offsetWidth/Height but
42+
// simply on el.hidden.
43+
import dom from "./core/dom";
44+
dom.is_visible = (el) => {
45+
return !el.hidden;
46+
};

0 commit comments

Comments
 (0)