UNPKG

@cainiaofe/cn-ui-m

Version:
25 lines (24 loc) 1.12 kB
import { __assign } from "tslib"; import React from 'react'; import { render } from '@testing-library/react'; import { CnDownload } from '../index'; describe('CnDownload 支持native-props', function () { it('最外层元素,支持data-xxx 属性', function () { var nativePropsCase = { 'data-name': 'test-name', 'data-hottag': 'test-hottag', }; var container = render(React.createElement(CnDownload, __assign({}, nativePropsCase))).container; var testCase = container.firstChild; expect(testCase).toHaveAttribute('data-name', 'test-name'); expect(testCase).toHaveAttribute('data-hottag', 'test-hottag'); }); it('最外层元素,支持 elementtiming 属性', function () { var nativePropsCase = { elementtiming: '渲染CnDownload节点时机', }; var container = render(React.createElement(CnDownload, __assign({}, nativePropsCase))).container; var testCase = container.firstChild; expect(testCase).toHaveAttribute('elementtiming', '渲染CnDownload节点时机'); }); });