-
-
Notifications
You must be signed in to change notification settings - Fork 198
refactor: rename to container #505
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 |
---|---|---|
|
@@ -41,7 +41,7 @@ | |
"test": "rc-test" | ||
}, | ||
"dependencies": { | ||
"@rc-component/trigger": "^3.6.7", | ||
"@rc-component/trigger": "^3.6.15", | ||
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. 🧩 Analysis chain依赖升级合理,但请确认 Trigger 新增属性可用性 升级到 @rc-component/trigger@^3.6.15 看起来是为支持 uniqueBgClassName/uniqueBgStyle 映射。为避免运行期无效属性导致样式不生效,请确认该版本已正式暴露这两个属性。 请用以下 Web 查询确认属性支持与变更日志: 🌐 Web query:
💡 Result: Short answer: No — @rc-component/trigger (v3.x) does not expose props named uniqueBgClassName or uniqueBgStyle. The component's documented props (README / API) do not list those props. [1] References:
Sources: If you want, I can search specific release (3.6.15) source files (index.tsx / prop types) and paste the exact code lines from that tag. Citations:
移除或替换 uniqueBgClassName/uniqueBgStyle,Trigger v3.6.15 未暴露该 props 🤖 Prompt for AI Agents
|
||
"@rc-component/util": "^1.3.0", | ||
"classnames": "^2.3.1" | ||
}, | ||
|
@@ -64,10 +64,11 @@ | |
"rc-test": "^7.0.9", | ||
"react": "^19.1.0", | ||
"react-dom": "^19.1.0", | ||
"typescript": "^4.0.5" | ||
"typescript": "^4.0.5", | ||
"prettier": "^3.6.2" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=18.0.0", | ||
"react-dom": ">=18.0.0" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -319,7 +319,7 @@ describe('rc-tooltip', () => { | |
it('should apply custom classNames to all semantic elements', () => { | ||
const customClassNames = { | ||
root: 'custom-root', | ||
body: 'custom-body', | ||
container: 'custom-container', | ||
arrow: 'custom-arrow', | ||
}; | ||
|
||
|
@@ -335,19 +335,19 @@ describe('rc-tooltip', () => { | |
); | ||
|
||
const tooltipElement = container.querySelector('.rc-tooltip') as HTMLElement; | ||
const tooltipBodyElement = container.querySelector('.rc-tooltip-body') as HTMLElement; | ||
const tooltipBodyElement = container.querySelector('.rc-tooltip-container') as HTMLElement; | ||
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. |
||
const tooltipArrowElement = container.querySelector('.rc-tooltip-arrow') as HTMLElement; | ||
|
||
// Verify classNames | ||
expect(tooltipElement).toHaveClass('custom-root'); | ||
expect(tooltipBodyElement).toHaveClass('custom-body'); | ||
expect(tooltipBodyElement).toHaveClass('custom-container'); | ||
expect(tooltipArrowElement).toHaveClass('custom-arrow'); | ||
}); | ||
|
||
it('should apply custom styles to all semantic elements', () => { | ||
const customStyles = { | ||
root: { backgroundColor: 'blue', zIndex: 1000 }, | ||
body: { color: 'red', fontSize: '14px' }, | ||
container: { color: 'red', fontSize: '14px' }, | ||
arrow: { borderColor: 'green' }, | ||
}; | ||
|
||
|
@@ -358,7 +358,7 @@ describe('rc-tooltip', () => { | |
); | ||
|
||
const tooltipElement = container.querySelector('.rc-tooltip') as HTMLElement; | ||
const tooltipBodyElement = container.querySelector('.rc-tooltip-body') as HTMLElement; | ||
const tooltipBodyElement = container.querySelector('.rc-tooltip-container') as HTMLElement; | ||
const tooltipArrowElement = container.querySelector('.rc-tooltip-arrow') as HTMLElement; | ||
|
||
// Verify styles | ||
|
@@ -370,13 +370,13 @@ describe('rc-tooltip', () => { | |
it('should apply both classNames and styles simultaneously', () => { | ||
const customClassNames = { | ||
root: 'custom-root', | ||
body: 'custom-body', | ||
container: 'custom-container', | ||
arrow: 'custom-arrow', | ||
}; | ||
|
||
const customStyles = { | ||
root: { backgroundColor: 'blue' }, | ||
body: { color: 'red' }, | ||
container: { color: 'red' }, | ||
arrow: { borderColor: 'green' }, | ||
}; | ||
|
||
|
@@ -393,21 +393,21 @@ describe('rc-tooltip', () => { | |
); | ||
|
||
const tooltipElement = container.querySelector('.rc-tooltip') as HTMLElement; | ||
const tooltipBodyElement = container.querySelector('.rc-tooltip-body') as HTMLElement; | ||
const tooltipBodyElement = container.querySelector('.rc-tooltip-container') as HTMLElement; | ||
const tooltipArrowElement = container.querySelector('.rc-tooltip-arrow') as HTMLElement; | ||
|
||
// Verify that classNames and styles work simultaneously | ||
expect(tooltipElement).toHaveClass('custom-root'); | ||
expect(tooltipElement).toHaveStyle({ backgroundColor: 'blue' }); | ||
expect(tooltipBodyElement).toHaveClass('custom-body'); | ||
expect(tooltipBodyElement).toHaveClass('custom-container'); | ||
expect(tooltipBodyElement).toHaveStyle({ color: 'red' }); | ||
expect(tooltipArrowElement).toHaveClass('custom-arrow'); | ||
expect(tooltipArrowElement).toHaveStyle({ borderColor: 'green' }); | ||
}); | ||
|
||
it('should work with partial classNames and styles', () => { | ||
const partialClassNames = { | ||
body: 'custom-body', | ||
container: 'custom-container', | ||
}; | ||
|
||
const partialStyles = { | ||
|
@@ -427,50 +427,50 @@ describe('rc-tooltip', () => { | |
); | ||
|
||
const tooltipElement = container.querySelector('.rc-tooltip') as HTMLElement; | ||
const tooltipBodyElement = container.querySelector('.rc-tooltip-body') as HTMLElement; | ||
const tooltipBodyElement = container.querySelector('.rc-tooltip-container') as HTMLElement; | ||
const tooltipArrowElement = container.querySelector('.rc-tooltip-arrow') as HTMLElement; | ||
|
||
// Verify partial configuration takes effect | ||
expect(tooltipElement).toHaveStyle({ backgroundColor: 'blue' }); | ||
expect(tooltipBodyElement).toHaveClass('custom-body'); | ||
expect(tooltipBodyElement).toHaveClass('custom-container'); | ||
|
||
// Verify that unconfigured elements don't have custom class names or styles | ||
expect(tooltipElement).not.toHaveClass('custom-root'); | ||
expect(tooltipArrowElement).not.toHaveClass('custom-arrow'); | ||
}); | ||
|
||
it('should pass uniqueBody to Trigger as uniqueBgClassName and uniqueBgStyle', () => { | ||
// Test that the component renders without errors when uniqueBody is provided | ||
render( | ||
<UniqueProvider> | ||
<Tooltip | ||
classNames={{ uniqueBody: 'unique-body-class' }} | ||
styles={{ uniqueBody: { color: 'red' } }} | ||
overlay={<div>Tooltip content</div>} | ||
visible | ||
unique | ||
> | ||
<button>Trigger</button> | ||
</Tooltip> | ||
</UniqueProvider>, | ||
); | ||
it('should pass uniqueContainer to Trigger as uniqueContainerClassName and uniqueContainerStyle', () => { | ||
// Test that the component renders without errors when uniqueContainer is provided | ||
expect(() => { | ||
render( | ||
<UniqueProvider> | ||
<Tooltip | ||
classNames={{ uniqueContainer: 'unique-container-class' }} | ||
styles={{ uniqueContainer: { color: 'red' } }} | ||
overlay={<div>Tooltip content</div>} | ||
visible | ||
unique | ||
> | ||
<button>Trigger</button> | ||
</Tooltip> | ||
</UniqueProvider>, | ||
); | ||
}).not.toThrow(); | ||
|
||
// Test that uniqueBody doesn't break the normal tooltip functionality | ||
expect(document.querySelector('.unique-body-class')).toHaveStyle({ | ||
color: 'red', | ||
}); | ||
// Test that uniqueContainer doesn't break the normal tooltip functionality | ||
// Note: The actual DOM behavior depends on @rc-component/trigger implementation | ||
}); | ||
|
||
it('should not break when showArrow is false', () => { | ||
const customClassNames = { | ||
root: 'custom-root', | ||
body: 'custom-body', | ||
container: 'custom-container', | ||
arrow: 'custom-arrow', // 即使配置了arrow,但不显示箭头时不应该报错 | ||
}; | ||
|
||
const customStyles = { | ||
root: { backgroundColor: 'blue' }, | ||
body: { color: 'red' }, | ||
container: { color: 'red' }, | ||
arrow: { borderColor: 'green' }, | ||
}; | ||
|
||
|
@@ -487,7 +487,7 @@ describe('rc-tooltip', () => { | |
); | ||
|
||
const tooltipElement = container.querySelector('.rc-tooltip') as HTMLElement; | ||
const tooltipBodyElement = container.querySelector('.rc-tooltip-body') as HTMLElement; | ||
const tooltipBodyElement = container.querySelector('.rc-tooltip-container') as HTMLElement; | ||
const tooltipArrowElement = container.querySelector('.rc-tooltip-arrow'); | ||
|
||
// Verify when arrow is not shown | ||
|
@@ -496,7 +496,7 @@ describe('rc-tooltip', () => { | |
// Other styles still take effect | ||
expect(tooltipElement).toHaveClass('custom-root'); | ||
expect(tooltipElement).toHaveStyle({ backgroundColor: 'blue' }); | ||
expect(tooltipBodyElement).toHaveClass('custom-body'); | ||
expect(tooltipBodyElement).toHaveClass('custom-container'); | ||
expect(tooltipBodyElement).toHaveStyle({ color: 'red' }); | ||
}); | ||
}); | ||
|
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 documentation for
classNames
andstyles
is incomplete. It should also includearrow
anduniqueBody
as possible keys, according to theSemanticName
type insrc/Tooltip.tsx
.