File tree 1 file changed +32
-0
lines changed
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,38 @@ import inject from '../src/injector';
4
4
import ReactTestUtils from 'react-addons-test-utils' ;
5
5
6
6
describe ( 'injector' , ( ) => {
7
+ describe ( 'elements' , ( ) => {
8
+ it ( 'should inject in element' , ( ) => {
9
+ expect (
10
+ inject ( < span foo = "bar" > </ span > ) ( 'Foo' )
11
+ ) . toEqual (
12
+ < span foo = "bar" className = "⚛Foo " > </ span >
13
+ ) ;
14
+
15
+ //eslint-disable-next-line
16
+ class Foo extends React . Component {
17
+ render ( ) {
18
+ return < div /> ;
19
+ }
20
+ }
21
+
22
+ //eslint-disable-next-line
23
+ class Bar extends React . Component {
24
+ render ( ) {
25
+ return < Foo /> ;
26
+ }
27
+ }
28
+
29
+ expect (
30
+ inject ( < Bar foo = "bar" /> ) ( 'Foo' )
31
+ ) . toEqual (
32
+ < div className = "⚛Foo" >
33
+ < Bar foo = "bar" />
34
+ </ div >
35
+ ) ;
36
+ } ) ;
37
+ } ) ;
38
+
7
39
describe ( 'functional stateless components' , ( ) => {
8
40
it ( 'should inject in functional stateless component' , ( ) => {
9
41
/* eslint-disable */
You can’t perform that action at this time.
0 commit comments