UNPKG

@cainiaofe/cn-ui-m

Version:
16 lines (15 loc) 739 B
import React from 'react'; import { render } from '@testing-library/react'; import { CnDemoBlock } from '../index'; describe('CnDemo', function () { it('将 style 传递给第一个DOM元素', function () { var style = { color: 'red' }; var container = render(React.createElement(CnDemoBlock, { title: "demo", style: style }, "123")).container; expect(container.firstChild).toHaveStyle('color: red'); }); it('将className传递给第一个DOM元素', function () { var className = 'test-class'; var container = render(React.createElement(CnDemoBlock, { title: "demo", className: className }, "123")).container; expect(container.firstChild).toHaveClass('test-class'); }); });