Skip to content

Fix propType tests for latest React (v15.2.0) #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ on itself and thus must have callbacks attached to be useful.
handle: string,
onStart: DraggableEventHandler,
onDrag: DraggableEventHandler,
onStop: DraggableEventHandler
onStop: DraggableEventHandler,
onMouseDown: (e: MouseEvent) => void
}
```
Expand Down
18 changes: 15 additions & 3 deletions specs/draggable.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,35 @@ describe('react-draggable', function () {

TestUtils.renderIntoDocument(drag);

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

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

TestUtils.renderIntoDocument(drag);

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

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

TestUtils.renderIntoDocument(drag);

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

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