-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from oceanbase/dengfuping-theme
🐞 fix(design): spin and theme should inherit from parent context for ConfigProvider
- Loading branch information
Showing
3 changed files
with
71 additions
and
29 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
packages/design/src/config-provider/__tests__/theme.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { ConfigProvider, useToken } from '@oceanbase/design'; | ||
|
||
describe('ConfigProvider theme', () => { | ||
it('ConfigProvider theme token', () => { | ||
const Child1 = () => { | ||
const { token } = useToken(); | ||
expect(token.colorBgLayout).toBe('#F5F8FE'); | ||
return <div />; | ||
}; | ||
const Child2 = () => { | ||
const { token } = useToken(); | ||
expect(token.colorBgLayout).toBe('#ff0000'); | ||
return <div />; | ||
}; | ||
const Child3 = () => { | ||
const { token } = useToken(); | ||
expect(token.colorBgLayout).toBe('#ff0000'); | ||
return <div />; | ||
}; | ||
render( | ||
<ConfigProvider> | ||
<Child1 /> | ||
<ConfigProvider | ||
theme={{ | ||
token: { | ||
colorBgLayout: '#ff0000', | ||
}, | ||
}} | ||
> | ||
<Child2 /> | ||
<ConfigProvider> | ||
<Child3 /> | ||
</ConfigProvider> | ||
</ConfigProvider> | ||
</ConfigProvider> | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters