@cainiaofe/cn-ui-m
Version:
16 lines (15 loc) • 908 B
JavaScript
import React from 'react';
import { render } from '@testing-library/react';
import { CnActionSheet } from '../index';
describe('CnActionSheet', function () {
it('将 style 传递给第一个DOM元素', function () {
var style = { color: 'red' };
var getByTestId = render(React.createElement(CnActionSheet, { visible: true, options: ['选项 1', '选项 2', '选项 3', '选项 4', '选项 5'], style: style })).getByTestId;
expect(getByTestId('cn-modal-container')).toHaveStyle('color: red');
});
it('将className传递给第一个DOM元素', function () {
var className = 'my-class';
var getByTestId = render(React.createElement(CnActionSheet, { visible: true, className: className, options: ['选项 1', '选项 2', '选项 3', '选项 4', '选项 5'] })).getByTestId;
expect(getByTestId('cn-modal-content')).toHaveClass('my-class');
});
});