-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
29 lines (27 loc) · 827 Bytes
/
Copy pathjest.setup.js
File metadata and controls
29 lines (27 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Mimics ProvidePlugin configuration for jQuery
global.$ = global.jQuery = window.jQuery = require('jquery');
// Foundation requires existing script tag to load properly
document
.getElementsByTagName('head')[0]
.appendChild(document.createElement('script'));
// jQuery thinks all elements are not visible under jsdom
// See https://github.com/jsdom/jsdom/issues/1048
window.Element.prototype.getClientRects = function () {
var node = this;
while (node) {
if (node === document) {
break;
}
// don't know why but style is sometimes undefined
if (
!node.style ||
node.style.display === 'none' ||
node.style.visibility === 'hidden'
) {
return [];
}
node = node.parentNode;
}
var self = $(this);
return [{ width: self.width(), height: self.height() }];
};