-
Notifications
You must be signed in to change notification settings - Fork 194
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
Kent C. Dodds
committed
Jul 13, 2016
1 parent
700c975
commit 812095e
Showing
6 changed files
with
49 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react' | ||
import {mount} from 'enzyme' | ||
import RepoFilter from './RepoFilter' | ||
import sinon from 'sinon' | ||
|
||
describe(RepoFilter.displayName, () => { | ||
it('should call the onKeyUp prop', () => { | ||
const onKeyUp = sinon.spy() | ||
const wrapper = mountComponent({onKeyUp}) | ||
const input = wrapper.find('input') | ||
const key = 'b' | ||
input.simulate('keyup', {target: {value: key}}) | ||
expect(onKeyUp).to.have.been.calledWith(key) | ||
}) | ||
|
||
it('should have a default onKeyUp handler', () => { | ||
const wrapper = mountComponent() | ||
const input = wrapper.find('input') | ||
expect(() => input.simulate('keyup')).to.not.throw() | ||
}) | ||
}) | ||
|
||
function mountComponent(props) { | ||
return mount(<RepoFilter {...props}/>) | ||
} | ||
|
||
function setInputValue(input, value) { | ||
input.simulate('change', {target: {value}}); | ||
} |
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 |
---|---|---|
@@ -1,4 +1,13 @@ | ||
import {jsdom} from 'jsdom' | ||
import chai from 'chai' | ||
import chaiEnzyme from 'chai-enzyme' | ||
import sinonChai from 'sinon-chai' | ||
|
||
chai.use(chaiEnzyme()) | ||
chai.use(sinonChai) | ||
global.expect = chai.expect | ||
|
||
global.document = jsdom('<body></body>') | ||
global.window = document.defaultView | ||
global.navigator = window.navigator | ||
global.location = window.location |
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