-
-
Notifications
You must be signed in to change notification settings - Fork 198
feat: semantic add uniqueBody #503
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,3 +1,4 @@ | ||
import Trigger from '@rc-component/trigger/lib/mock'; | ||
import Trigger, { UniqueProvider } from '@rc-component/trigger/lib/mock'; | ||
|
||
export default Trigger; | ||
export { UniqueProvider }; |
This file contains hidden or 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,3 +1,4 @@ | ||
import { UniqueProvider } from '@rc-component/trigger'; | ||
import { act, fireEvent, render } from '@testing-library/react'; | ||
import React from 'react'; | ||
import Tooltip, { type TooltipRef } from '../src'; | ||
|
@@ -59,8 +60,6 @@ describe('rc-tooltip', () => { | |
verifyContent(container, 'Tooltip content'); | ||
}); | ||
|
||
|
||
|
||
it('access of ref', () => { | ||
const domRef = React.createRef<TooltipRef>(); | ||
render( | ||
|
@@ -353,12 +352,7 @@ describe('rc-tooltip', () => { | |
}; | ||
|
||
const { container } = render( | ||
<Tooltip | ||
styles={customStyles} | ||
overlay={<div>Tooltip content</div>} | ||
visible | ||
showArrow | ||
> | ||
<Tooltip styles={customStyles} overlay={<div>Tooltip content</div>} visible showArrow> | ||
<button>Trigger</button> | ||
</Tooltip>, | ||
); | ||
|
@@ -439,12 +433,36 @@ describe('rc-tooltip', () => { | |
// Verify partial configuration takes effect | ||
expect(tooltipElement).toHaveStyle({ backgroundColor: 'blue' }); | ||
expect(tooltipBodyElement).toHaveClass('custom-body'); | ||
|
||
// 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>, | ||
); | ||
|
||
console.log(document.body.innerHTML); | ||
|
||
|
||
// Test that uniqueBody doesn't break the normal tooltip functionality | ||
expect(document.querySelector('.unique-body-class')).toHaveStyle({ | ||
color: 'red', | ||
}); | ||
}); | ||
|
||
it('should not break when showArrow is false', () => { | ||
const customClassNames = { | ||
root: 'custom-root', | ||
|
@@ -476,7 +494,7 @@ describe('rc-tooltip', () => { | |
|
||
// Verify when arrow is not shown | ||
expect(tooltipArrowElement).toBeFalsy(); | ||
|
||
// Other styles still take effect | ||
expect(tooltipElement).toHaveClass('custom-root'); | ||
expect(tooltipElement).toHaveStyle({ backgroundColor: 'blue' }); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
依赖升级至 @rc-component/trigger@^3.6.7:请核实导出与新 props 一致
为确保与本 PR 新增的
UniqueProvider
、uniqueBgClassName
/uniqueBgStyle
对齐,请确认 3.6.7 起确已导出/支持并有对应类型声明;否则会出现类型或运行时不匹配。🌐 Web query:
💡 Result:
短答:不支持。
参考:
(如果你需要,我可以为你在某个具体版本的包构建产物或 unpkg 上打开对应版本的 index 文件并截取导出符号以做进一步确认。)
@rc-component/trigger@^3.6.7 不包含 UniqueProvider,且 不支持 uniqueBgClassName/uniqueBgStyle — 需修复
🤖 Prompt for AI Agents