-
Notifications
You must be signed in to change notification settings - Fork 94
feat: ColorBlock support inner style #273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |||||
| import { fireEvent, render } from '@testing-library/react'; | ||||||
| import React from 'react'; | ||||||
| import { expect } from 'vitest'; | ||||||
| import ColorPicker, { type BaseSliderProps } from '../src'; | ||||||
| import ColorPicker, { ColorBlock, type BaseSliderProps } from '../src'; | ||||||
| import { defaultColor } from '../src/util'; | ||||||
|
|
||||||
| describe('ColorPicker.Components', () => { | ||||||
|
|
@@ -56,4 +56,19 @@ describe('ColorPicker.Components', () => { | |||||
| fireEvent.click(alphaEle); | ||||||
| expect(alphaEle.textContent).toBe('0/100/33'); | ||||||
| }); | ||||||
|
|
||||||
| it('ColorBlock support innerClassName and innerStyle', () => { | ||||||
| const { container } = render( | ||||||
| <ColorBlock | ||||||
| prefixCls="test" | ||||||
| color="red" | ||||||
| innerClassName="my-inner-class" | ||||||
| innerStyle={{ color: '#903' }} | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test for
Suggested change
|
||||||
| />, | ||||||
| ); | ||||||
|
|
||||||
| const innerDiv = container.querySelector('.test-color-block-inner'); | ||||||
| expect(innerDiv).toHaveClass('my-inner-class'); | ||||||
| expect(innerDiv).toHaveStyle({ color: '#903' }); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| }); | ||||||
| }); | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments for
innerClassNameandinnerStyleare a bit verbose and could be more direct. The phrase "semantic structure only" is also slightly ambiguous. Consider using the@internalJSDoc tag to signify internal usage, which is a standard convention and can be picked up by documentation generation tools. A more concise comment would improve readability and maintainability.