Skip to content

Commit 81de84e

Browse files
committed
Fix offsetParent calculations in test
1 parent 5d06162 commit 81de84e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

specs/draggable.spec.jsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ const transformStyle = browserPrefixToStyle('transform', getPrefix('transform'))
1010
const transformKey = browserPrefixToKey('transform', getPrefix('transform'));
1111
const userSelectStyle = browserPrefixToStyle('user-select', getPrefix('user-select'));
1212

13-
/*global describe,it,expect, afterEach */
1413
describe('react-draggable', function () {
1514
var drag;
1615

16+
// Remove body margin so offsetParent calculations work properly
17+
beforeAll(function() {
18+
const styleNode = document.createElement('style');
19+
// browser detection (based on prototype.js)
20+
const styleText = document.createTextNode('body {margin: 0;}');
21+
styleNode.appendChild(styleText);
22+
document.getElementsByTagName('head')[0].appendChild(styleNode);
23+
});
24+
1725
beforeEach(function() {
1826
spyOn(console, 'error');
1927
});

0 commit comments

Comments
 (0)