mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
* Copy some infra structure patterns from Flight * Basic data structures * Move structural nodes and instruction commands to host config * Move instruction command to host config In the DOM this is implemented as script tags. The first time it's emitted it includes the function. Future calls invoke the same function. The side of the complete boundary function in particular is unfortunately large. * Implement Fizz Noop host configs This is implemented not as a serialized protocol but by-passing the serialization when possible and instead it's like a live tree being built. * Implement React Native host config This is not wired up. I just need something for the flow types since Flight and Fizz are both handled by the isServerSupported flag. Might as well add something though. The principle of this format is the same structure as for HTML but a simpler binary format. Each entry is a tag followed by some data and terminated by null. * Check in error codes * Comment
36 lines
831 B
JavaScript
36 lines
831 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @emails react-core
|
|
* @jest-environment node
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
let React;
|
|
let ReactNoopServer;
|
|
|
|
describe('ReactServer', () => {
|
|
beforeEach(() => {
|
|
jest.resetModules();
|
|
|
|
React = require('react');
|
|
ReactNoopServer = require('react-noop-renderer/server');
|
|
});
|
|
|
|
function div(...children) {
|
|
children = children.map(c =>
|
|
typeof c === 'string' ? {text: c, hidden: false} : c,
|
|
);
|
|
return {type: 'div', children, prop: undefined, hidden: false};
|
|
}
|
|
|
|
it('can call render', () => {
|
|
const result = ReactNoopServer.render(<div>hello world</div>);
|
|
expect(result.root).toEqual(div('hello world'));
|
|
});
|
|
});
|