Skip to content

Commit d447faf

Browse files
committed
test injectInElement
1 parent baa17d0 commit d447faf

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/injector.js

+32
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,38 @@ import inject from '../src/injector';
44
import ReactTestUtils from 'react-addons-test-utils';
55

66
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+
739
describe('functional stateless components', () => {
840
it('should inject in functional stateless component', () => {
941
/* eslint-disable */

0 commit comments

Comments
 (0)