-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(module:progress): fix circle gradient not sorted (#4178)
* fix(module:progress): fix circle gradient not sorted
- Loading branch information
Wendell
authored
Sep 20, 2019
1 parent
d9bf4af
commit 7d37b1c
Showing
7 changed files
with
39 additions
and
39 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import { handleLinearGradient, sortGradient } from './nz-progress-utils'; | ||
import { handleCircleGradient, handleLinearGradient } from './nz-progress-utils'; | ||
|
||
// https://github.com/ant-design/ant-design/blob/330a952a988a4ae18c201b464c51d5faeb714f7c/components/progress/__tests__/index.test.js#L74-L88. | ||
describe('util functions', () => { | ||
describe('progress util functions', () => { | ||
it('get correct line-gradient', () => { | ||
expect(handleLinearGradient({ from: 'test', to: 'test' })).toBe('linear-gradient(to right, test, test)'); | ||
expect(handleLinearGradient({})).toBe('linear-gradient(to right, #1890ff, #1890ff)'); | ||
expect(handleLinearGradient({ from: 'test', to: 'test', '0%': 'test' })).toBe('linear-gradient(to right, test 0%)'); | ||
}); | ||
|
||
it('sort gradients correctly', () => { | ||
expect(sortGradient({ '10%': 'test10', '30%': 'test30', '20%': 'test20' })).toBe( | ||
'test10 10%, test20 20%, test30 30%' | ||
); | ||
it('get correct circle gradient', () => { | ||
const gradientOne = handleCircleGradient({ '10%': 'test10', '30%': 'test30', '20%': 'test20' }); | ||
expect(gradientOne[0].color).toBe('test10'); | ||
expect(gradientOne[0].offset).toBe('10%'); | ||
expect(gradientOne[1].color).toBe('test20'); | ||
expect(gradientOne[1].offset).toBe('20%'); | ||
}); | ||
}); |
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
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
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