Fix style prop of spin

This commit is contained in:
afc163 2017-01-27 14:27:18 +08:00
parent 29081542e6
commit 1a3ea43ebe
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,15 @@
import React from 'react';
import { shallow } from 'enzyme';
import Spin from '..';
describe('Spin', () => {
it('should only affect the spin element when set style to a nested <Spin>xx</Spin>', () => {
const wrapper = shallow(
<Spin style={{ background: 'red' }}>
<div>content</div>
</Spin>
);
expect(wrapper.find('.ant-spin-nested-loading').at(0).prop('style')).toBe(null);
expect(wrapper.find('.ant-spin').at(0).prop('style').background).toBe('red');
});
});

View File

@ -119,6 +119,7 @@ export default class Spin extends React.Component<SpinProps, any> {
{...divProps}
component="div"
className={`${prefixCls}-nested-loading`}
style={null}
transitionName="fade"
>
{spinning && <div key="loading">{spinElement}</div>}