forked from jaredpalmer/react-fns
-
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.
- Loading branch information
1 parent
de3adb4
commit 5a1f9a4
Showing
7 changed files
with
71 additions
and
5 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
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
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,29 @@ | ||
import * as React from 'react'; | ||
import * as ReactDOM from 'react-dom'; | ||
|
||
import { Network } from '../'; | ||
|
||
describe('<Network />', () => { | ||
describe('<Network render />', () => { | ||
const node = document.createElement('div'); | ||
|
||
afterEach(() => { | ||
ReactDOM.unmountComponentAtNode(node); | ||
}); | ||
|
||
it('receives { x, y } props', () => { | ||
ReactDOM.render( | ||
<Network | ||
render={props => expect(props).toEqual({ online: false }) || null} | ||
/>, | ||
node | ||
); | ||
}); | ||
|
||
it('renders elements', () => { | ||
ReactDOM.render(<Network render={() => <div>online</div>} />, node); | ||
|
||
expect(node.innerHTML.includes('online')).toBe(true); | ||
}); | ||
}); | ||
}); |
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,37 @@ | ||
import * as React from 'react'; | ||
import * as ReactDOM from 'react-dom'; | ||
|
||
import { withNetwork } from '../'; | ||
|
||
describe('withNetwork()', () => { | ||
const node = document.createElement('div'); | ||
|
||
afterEach(() => { | ||
ReactDOM.unmountComponentAtNode(node); | ||
}); | ||
|
||
it('receives { online } props', () => { | ||
const hello = 'hi'; | ||
|
||
const WrappedComponent = withNetwork<{ hello: string }>( | ||
props => expect(props).toEqual({ online: false, hello }) || null | ||
); | ||
|
||
ReactDOM.render(<WrappedComponent hello={hello} />, node); | ||
}); | ||
|
||
// it('renders elements and passes thru props', () => { | ||
// const hello = 'hi'; | ||
|
||
// const WrappedComponent = withNetwork<{ hello: string }>(props => ( | ||
// <div> | ||
// x: {props.x}, y: {props.y} {hello} | ||
// </div> | ||
// )); | ||
|
||
// ReactDOM.render(<WrappedComponent hello={hello} />, node); | ||
|
||
// expect(node.innerHTML.includes('0')).toBe(true); | ||
// expect(node.innerHTML.includes('hi')).toBe(true); | ||
// }); | ||
}); |