main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 6 months ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
737 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import * as React from 'react';
|
---|
| 2 | import {renderToString} from 'react-dom/server';
|
---|
| 3 | import {expect} from 'chai';
|
---|
| 4 | import render from '../render';
|
---|
| 5 | import createEnhancer from '../createEnhancer';
|
---|
| 6 |
|
---|
| 7 | const Parent = (props) => render(props, {foo: 'bar'});
|
---|
| 8 | const withParent = createEnhancer(Parent, 'parent');
|
---|
| 9 |
|
---|
| 10 | describe('createEnhancer() SSR', () => {
|
---|
| 11 | it('exists and does not crash', () => {
|
---|
| 12 | expect(typeof createEnhancer).to.equal('function');
|
---|
| 13 | });
|
---|
| 14 |
|
---|
| 15 | it('renders as expected', () => {
|
---|
| 16 | const Comp = (props) => <div>{props.parent.foo}</div>;
|
---|
| 17 | const CompEnhanced = withParent(Comp);
|
---|
| 18 | const html = renderToString(<CompEnhanced />);
|
---|
| 19 |
|
---|
| 20 | expect(html).to.equal('<div data-reactroot="">bar</div>');
|
---|
| 21 | });
|
---|
| 22 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.