Skip to content

Commit 510d27c

Browse files
acustiSTRML
authored andcommitted
Fix propType tests for latest React (v15.2.0) (#176)
* Add missing comma in readme * ✅ Fix propType tests latest React React 15.2.0 changed propType validation warning text: https://github.com/facebook/react/blob/master/CHANGELOG.md#1520-july-1-2 016
1 parent 35f9ae5 commit 510d27c

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

specs/draggable.spec.jsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,35 @@ describe('react-draggable', function () {
122122

123123
TestUtils.renderIntoDocument(drag);
124124

125-
expect(console.error).toHaveBeenCalledWith('Warning: Failed propType: Invalid prop className passed to Draggable - do not set this, set it on the child.');
125+
expect(
126+
console.error.calls.argsFor(0)[0].replace('propType:', 'prop type:').split('\n')[0]
127+
).toBe(
128+
'Warning: Failed prop type: Invalid prop className passed to Draggable - do not set this, set it on the child.'
129+
);
126130
});
127131

128132
it('should throw when setting style', function () {
129133
drag = (<Draggable style={{color: 'red'}}><span /></Draggable>);
130134

131135
TestUtils.renderIntoDocument(drag);
132136

133-
expect(console.error).toHaveBeenCalledWith('Warning: Failed propType: Invalid prop style passed to Draggable - do not set this, set it on the child.');
137+
expect(
138+
console.error.calls.argsFor(0)[0].replace('propType:', 'prop type:').split('\n')[0]
139+
).toBe(
140+
'Warning: Failed prop type: Invalid prop style passed to Draggable - do not set this, set it on the child.'
141+
);
134142
});
135143

136144
it('should throw when setting transform', function () {
137145
drag = (<Draggable transform="translate(100, 100)"><span /></Draggable>);
138146

139147
TestUtils.renderIntoDocument(drag);
140148

141-
expect(console.error).toHaveBeenCalledWith('Warning: Failed propType: Invalid prop transform passed to Draggable - do not set this, set it on the child.');
149+
expect(
150+
console.error.calls.argsFor(0)[0].replace('propType:', 'prop type:').split('\n')[0]
151+
).toBe(
152+
'Warning: Failed prop type: Invalid prop transform passed to Draggable - do not set this, set it on the child.'
153+
);
142154
});
143155

144156
it('should call onStart when dragging begins', function () {

0 commit comments

Comments
 (0)