ant-design/components/config-provider/__tests__/index.test.js
2019-08-27 18:31:01 +08:00

31 lines
795 B
JavaScript

import React from 'react';
import { mount } from 'enzyme';
import ConfigProvider from '..';
import Button from '../../button';
import mountTest from '../../../tests/shared/mountTest';
describe('ConfigProvider', () => {
mountTest(() => <ConfigProvider><div /></ConfigProvider>);
it('Content Security Policy', () => {
const csp = { nonce: 'test-antd' };
const wrapper = mount(
<ConfigProvider csp={csp}>
<Button />
</ConfigProvider>,
);
expect(wrapper.find('Wave').instance().csp).toBe(csp);
});
it('autoInsertSpaceInButton', () => {
const wrapper = mount(
<ConfigProvider autoInsertSpaceInButton={false}>
<Button>确定</Button>
</ConfigProvider>,
);
expect(wrapper.find('Button').text()).toBe('确定');
});
});