UNPKG

@cainiaofe/cn-ui-m

Version:
16 lines (15 loc) 862 B
import React from 'react'; import { render } from '@testing-library/react'; import { CnDialog } from '../index'; describe('CnDialog', function () { it('将 style 传递给第一个DOM元素', function () { var style = { color: 'red' }; var getByTestId = render(React.createElement(CnDialog, { visible: true, title: "Test Dialog", content: "This is a test dialog", style: style })).getByTestId; expect(getByTestId('cn-modal-container')).toHaveStyle('color: red'); }); it('将className传递给第一个DOM元素', function () { var className = 'test-class'; var getByTestId = render(React.createElement(CnDialog, { visible: true, title: "Test Dialog", content: "This is a test dialog", className: className })).getByTestId; expect(getByTestId('cn-modal-content')).toHaveClass('test-class'); }); });