📜  react 中的浅渲染 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:25.232000             🧑  作者: Mango

代码示例1
import ShallowRenderer from 'react-test-renderer/shallow';

// in your test:
const renderer = new ShallowRenderer();
renderer.render();
const result = renderer.getRenderOutput();

expect(result.type).toBe('div');
expect(result.props.children).toEqual([
  Title,
  
]);