UNPKG

@cainiaofe/cn-ui-m

Version:
22 lines (21 loc) 1.21 kB
import React from 'react'; import { render } from '@testing-library/react'; import { CnOSSUpload } from '../index'; describe('CnOssUpload', function () { it('将 style 传递给第一个DOM元素', function () { var style = { color: 'red' }; var getByTestId = render(React.createElement(CnOSSUpload, { limit: 3, multiple: true, requestConfig: { // 测试接口,业务场景切勿使用,数据随时会被删除 url: 'https://pre-cnui.cainiao-inc.com/api/tars2/file/upload/getUploadFileScrip', }, style: style })).getByTestId; expect(getByTestId('cn-oss-upload')).toHaveStyle('color: red'); }); it('将className传递给第一个DOM元素', function () { var className = 'test-class'; var getByTestId = render(React.createElement(CnOSSUpload, { limit: 3, multiple: true, requestConfig: { // 测试接口,业务场景切勿使用,数据随时会被删除 url: 'https://pre-cnui.cainiao-inc.com/api/tars2/file/upload/getUploadFileScrip', }, className: className })).getByTestId; expect(getByTestId('cn-oss-upload')).toHaveClass('test-class'); }); });