mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-11 11:32:52 +08:00
fix(theme): inconsistent results with different algorithm order (#38481)
* fix(theme): inconsistent results with different algorithm order * fix: revert * fix: revert * fix: revert again * test: update * fix: lint
This commit is contained in:
parent
f25da16c52
commit
382b2cacf7
@ -153,4 +153,27 @@ describe('ConfigProvider.Theme', () => {
|
||||
|
||||
theme.defaultConfig.hashed = false;
|
||||
});
|
||||
|
||||
it('The order does not affect the result', () => {
|
||||
const tokens = {
|
||||
a: {},
|
||||
b: {},
|
||||
};
|
||||
const Token: React.FC<{ type: 'a' | 'b' }> = ({ type }) => {
|
||||
const [, token] = useToken();
|
||||
tokens[type] = token;
|
||||
return null;
|
||||
};
|
||||
render(
|
||||
<>
|
||||
<ConfigProvider theme={{ algorithm: [darkAlgorithm, compactAlgorithm] }}>
|
||||
<Token type="a" />
|
||||
</ConfigProvider>
|
||||
<ConfigProvider theme={{ algorithm: [compactAlgorithm, darkAlgorithm] }}>
|
||||
<Token type="b" />
|
||||
</ConfigProvider>
|
||||
</>,
|
||||
);
|
||||
expect(tokens.a).toMatchObject(tokens.b);
|
||||
});
|
||||
});
|
||||
|
@ -32,7 +32,7 @@ const derivative: DerivativeFunc<SeedToken, MapToken> = (token, mapToken) => {
|
||||
// Dark tokens
|
||||
...colorPalettes,
|
||||
// Colors
|
||||
...genColorMapToken(mapToken ?? token, {
|
||||
...genColorMapToken(token, {
|
||||
generateColorPalettes,
|
||||
generateNeutralColorPalettes,
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user