File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " legit-tests" ,
3- "version" : " 0.4.0 " ,
3+ "version" : " 0.4.2 " ,
44 "description" : " a chainable testing library for React" ,
55 "main" : " lib/legit-tests.js" ,
66 "scripts" : {
2727 "homepage" : " https://github.com/legitcode/tests#readme" ,
2828 "devDependencies" : {
2929 "babel" : " ^5.8.23" ,
30- "babel-core" : " ^5.8.23 " ,
31- "babel-eslint" : " ^4.1.1 " ,
30+ "babel-core" : " ^5.8.25 " ,
31+ "babel-eslint" : " ^4.1.3 " ,
3232 "babel-loader" : " ^5.3.2" ,
33- "chai" : " ^3.2 .0" ,
34- "eslint" : " ^0.24 .1" ,
35- "eslint-plugin-react" : " ^2.7.0 " ,
36- "expect" : " ^1.8 .0" ,
37- "mocha" : " ^2.2.5 " ,
33+ "chai" : " ^3.3 .0" ,
34+ "eslint" : " ^1.5 .1" ,
35+ "eslint-plugin-react" : " ^3.4.2 " ,
36+ "expect" : " ^1.10 .0" ,
37+ "mocha" : " ^2.3.3 " ,
3838 "mocha-babel" : " ^3.0.0" ,
3939 "react-hot-loader" : " ^1.3.0" ,
40- "sinon" : " ^1.16.1" ,
41- "webpack" : " ^1.12.1" ,
42- "webpack-dev-server" : " ^1.10.1"
40+ "sinon" : " ^1.17.0"
4341 },
4442 "dependencies" : {
4543 "jsdom" : " ^6.5.1" ,
Original file line number Diff line number Diff line change @@ -30,9 +30,18 @@ class Test {
3030 return this
3131 }
3232
33- element ( callback ) {
34- let element = this . getFirst ( this . helpers . elements )
35- if ( this . helpers ) callback . call ( this , element )
33+ element ( select , callback ) {
34+ if ( ! this . helpers ) return
35+
36+ let element
37+ if ( typeof select === 'string' ) {
38+ element = this . helpers . elements [ select ]
39+ callback . call ( this , element )
40+ return this
41+ }
42+
43+ element = this . getFirst ( this . helpers . elements )
44+ select . call ( this , element )
3645 return this
3746 }
3847
Original file line number Diff line number Diff line change @@ -14,4 +14,13 @@ describe('.element', () => {
1414 expect ( box . props . children ) . to . be . equal ( 'found me!' )
1515 } )
1616 } ) ;
17+
18+ it ( 'should find box, not div' , ( ) => {
19+ Test ( < TestComponent /> )
20+ . find ( '.box' )
21+ . find ( 'div' )
22+ . element ( 'box' , box => {
23+ expect ( box . props . children ) . to . be . equal ( 'found me!' )
24+ } )
25+ } ) ;
1726} ) ;
You can’t perform that action at this time.
0 commit comments