Skip to content

Commit 2810c5e

Browse files
committed
updated the readme
1 parent 925eb30 commit 2810c5e

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ let spy = sinon.spy()
2121

2222

2323
//Calling a prop
24-
Test(<TestComponent onClick={spy}/>) //or shallow render Test(<Component/>, {shallow: true})
24+
Test(<TestComponent onClick={spy}/>)
2525
.find('button')
2626
.simulate({method: 'click', element: 'button'})
2727
.test(() => {
@@ -112,6 +112,37 @@ Test(<TestComponent />)
112112

113113
~~~
114114

115+
##DOM rendering
116+
__Shallow__ -- uses React shallow rendering (no DOM)
117+
~~~js
118+
Test(<TestComponent onClick={spy}/>, {shallow: true})
119+
.find('button')
120+
.simulate({method: 'click', element: 'button'})
121+
.test(() => {
122+
expect(spy.called).to.be.true
123+
})
124+
~~~
125+
126+
__Normal__ -- React render into document fragment
127+
~~~js
128+
Test(<TestComponent onClick={spy}/>)
129+
.find('button')
130+
.simulate({method: 'click', element: 'button'})
131+
.test(() => {
132+
expect(spy.called).to.be.true
133+
})
134+
~~~
135+
136+
__fullDOM__ -- ReactDOM render into document.body.div of jsdom
137+
~~~js
138+
Test(<section />, {fullDOM: true})
139+
.test(function() {
140+
expect(global.window.document.querySelector('section'))
141+
.to.be.okay
142+
})
143+
.clean() // restores the document.body to empty
144+
~~~
145+
115146
You can see more examples in the tests directory.
116147

117148
##Testing Alt Stores

0 commit comments

Comments
 (0)