forked from react-toolbox/react-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Jest 🃏 and upgrade Webpack and other dependencies
- Loading branch information
1 parent
60b147f
commit b48c17d
Showing
19 changed files
with
1,519 additions
and
1,309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export function themr() { | ||
return (Component) => { | ||
Component.defaultProps = Component.defaultProps || {}; // eslint-disable-line no-param-reassign | ||
Component.defaultProps.theme = {}; // eslint-disable-line no-param-reassign | ||
return Component; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,4 +169,5 @@ export { | |
DatePickerDialog, | ||
factory as datePickerFactory, | ||
}; | ||
export { Calendar }; | ||
export { DatePicker }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,20 @@ | ||
/* eslint-disable */ | ||
import expect from 'expect'; | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import ReactTestUtils from 'react-addons-test-utils'; | ||
import Menu from '../Menu'; | ||
import MenuItem, { MenuItem as RawMenuItem } from '../MenuItem'; | ||
import { shallow } from 'enzyme'; | ||
import { Menu } from '../Menu'; | ||
import { MenuItem } from '../MenuItem'; | ||
|
||
describe('MenuItem', () => { | ||
describe('#onClick', () => { | ||
it('passes to listener the event', () => { | ||
let listenerCalled = false; | ||
const handleClick = function (event) { | ||
listenerCalled = true; | ||
expect(event).toExist(); | ||
expect(event.target).toExist(); | ||
}; | ||
|
||
const tree = ReactTestUtils.renderIntoDocument( | ||
const onClick = jest.fn(); | ||
const wrapper = shallow( | ||
<Menu> | ||
<MenuItem key="1" onClick={handleClick} /> | ||
</Menu>); | ||
|
||
const menuItem = ReactTestUtils.findRenderedComponentWithType(tree, RawMenuItem); | ||
ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(menuItem)); | ||
<MenuItem key="1" onClick={onClick} /> | ||
</Menu>, | ||
); | ||
|
||
expect(listenerCalled).toBe(true); | ||
wrapper.find(MenuItem).first().simulate('click', { persist: () => {} }); | ||
expect(onClick).toHaveBeenCalled(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.