File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff 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+
115146You can see more examples in the tests directory.
116147
117148##Testing Alt Stores
You can’t perform that action at this time.
0 commit comments