Skip to content

Commit 95233cc

Browse files
committed
feat(Tag): wrap in ConfigProvider
1 parent abb6175 commit 95233cc

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/tag/tag.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Animate from '../animate';
55
import Icon from '../icon';
66
import { obj, func, support, KEYCODE } from '../util';
77
import zhCN from '../locale/zh-cn';
8+
import ConfigProvider from '../config-provider';
89

910
const { noop, bindCtx } = func;
1011

@@ -244,4 +245,4 @@ class Tag extends Component {
244245
}
245246
}
246247

247-
export default Tag;
248+
export default ConfigProvider.config(Tag);

test/tag/index-spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('Tag', () => {
1313

1414
describe('render', () => {
1515
it('should render nothing if tag is unvisible', () => {
16-
const wrapper = shallow(<Tag animation={false}/>).dive();
16+
const wrapper = shallow(<Tag animation={false}/>).dive().dive();
1717
// note: react setState is asynchronous
1818
// so must force update or setTimeout in test suit to check render results.
1919
wrapper.setState({
@@ -35,14 +35,14 @@ describe('Tag', () => {
3535

3636
it('`afterAppear` should be called when tag appeared', () => {
3737
const afterAppearCb = sinon.spy();
38-
const wrapper = shallow(<Tag afterAppear={afterAppearCb} />).dive();
38+
const wrapper = shallow(<Tag afterAppear={afterAppearCb} />).dive().dive();
3939
wrapper.instance().handleAnimationInit();
4040
assert(afterAppearCb.calledOnce === true);
4141
});
4242

4343
it('`afterLeave` should be called when tag leaved', () => {
4444
const afterLeaveCb = sinon.spy();
45-
const wrapper = shallow(<Tag afterClose={afterLeaveCb} />).dive();
45+
const wrapper = shallow(<Tag afterClose={afterLeaveCb} />).dive().dive();
4646
wrapper.instance().handleAnimationEnd();
4747
assert(afterLeaveCb.calledOnce === true);
4848
});
@@ -71,7 +71,7 @@ describe('Tag', () => {
7171
});
7272

7373
it('tag should be destroyed after unmoun', () => {
74-
const wrapper = shallow(<Tag />).dive();
74+
const wrapper = shallow(<Tag />).dive().dive();
7575
const willUnmount = sinon.spy();
7676
const instance = wrapper.instance();
7777
// for coverage

0 commit comments

Comments
 (0)