diff --git a/components/config-provider/__tests__/icon.test.js b/components/config-provider/__tests__/icon.test.js
index 5cc87f5ad4..f35cf93636 100644
--- a/components/config-provider/__tests__/icon.test.js
+++ b/components/config-provider/__tests__/icon.test.js
@@ -16,17 +16,30 @@ describe('ConfigProvider.Icon', () => {
});
});
- it('basic', () => {
- const wrapper = mount(
-
-
- ,
- );
+ describe('csp', () => {
+ it('raw', () => {
+ mount(
+
+
+ ,
+ );
- const styleNode = document.querySelector('style');
+ const styleNode = document.querySelector('style');
+ expect(styleNode.nonce).toEqual('little');
+ });
- expect(wrapper.exists('.bamboo-smile')).toBeTruthy();
- expect(styleNode.nonce).toEqual('light');
+ it('mix with iconPrefixCls', () => {
+ const wrapper = mount(
+
+
+ ,
+ );
+
+ const styleNode = document.querySelector('style');
+
+ expect(wrapper.exists('.bamboo-smile')).toBeTruthy();
+ expect(styleNode.nonce).toEqual('light');
+ });
});
it('nest', () => {
diff --git a/components/config-provider/index.tsx b/components/config-provider/index.tsx
index bb98b5164a..cabb83257c 100644
--- a/components/config-provider/index.tsx
+++ b/components/config-provider/index.tsx
@@ -211,7 +211,7 @@ const ProviderChildren: React.FC = props => {
const memoIconContextValue = React.useMemo(
() => ({ prefixCls: iconPrefixCls, csp }),
- [iconPrefixCls],
+ [iconPrefixCls, csp],
);
let childNode = children;
@@ -238,7 +238,7 @@ const ProviderChildren: React.FC = props => {
);
}
- if (iconPrefixCls) {
+ if (iconPrefixCls || csp) {
childNode = (
{childNode}
);