Skip to content

Commit

Permalink
test injectInElement
Browse files Browse the repository at this point in the history
  • Loading branch information
mbasso committed Jan 12, 2017
1 parent baa17d0 commit d447faf
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,38 @@ import inject from '../src/injector';
import ReactTestUtils from 'react-addons-test-utils';

describe('injector', () => {
describe('elements', () => {
it('should inject in element', () => {
expect(
inject(<span foo="bar" ></span>)('Foo')
).toEqual(
<span foo="bar" className="⚛Foo " ></span>
);

//eslint-disable-next-line
class Foo extends React.Component {
render() {
return <div />;
}
}

//eslint-disable-next-line
class Bar extends React.Component {
render() {
return <Foo />;
}
}

expect(
inject(<Bar foo="bar" />)('Foo')
).toEqual(
<div className="⚛Foo" >
<Bar foo="bar" />
</div>
);
});
});

describe('functional stateless components', () => {
it('should inject in functional stateless component', () => {
/* eslint-disable */
Expand Down

0 comments on commit d447faf

Please sign in to comment.