-
Notifications
You must be signed in to change notification settings - Fork 297
Feat v16 noticebar simple #3491
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
Open
xiyehutao
wants to merge
7
commits into
jdf2e:feat_v4.x
Choose a base branch
from
xiyehutao:feat_v16_noticebar_simple
base: feat_v4.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6fd776a
feat: noticebar升级16.0暂存
xiyehutao cb814ca
feat: NoticeBar 16.0 设计对齐 — 样式变量/文档/demo 全面更新
xiyehutao f8bde5e
Merge branch 'feat_v4.x' into feat_v16_noticebar_simple
xiyehutao 0acab1b
feat: 修改倒计时圆环实现&部分问题fix
xiyehutao 1f8ba7b
fix: 补齐主题变量文件中缺失的 noticebar 样式变量
xiyehutao 8f2d683
fix: code review 问题修复
xiyehutao 88eb99f
feat: 为NoticeBar打标v16
xiyehutao 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1005,7 +1005,7 @@ | |
| "v15": 2, | ||
| "author": "vickyYe", | ||
| "dd": false, | ||
| "v16": false | ||
| "v16": true | ||
| }, | ||
| { | ||
| "version": "3.0.0", | ||
|
|
||
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
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 |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import React from 'react' | ||
| import { NoticeBar, Button } from '@nutui/nutui-react' | ||
| import { Notice } from '@nutui/icons-react' | ||
|
|
||
| const Demo12 = () => { | ||
| return ( | ||
| <> | ||
| <NoticeBar | ||
| content="提示文案描述文案描文案" | ||
| tag={<Notice width={12} height={12} />} | ||
| action={ | ||
| <Button size="small" type="primary"> | ||
| 强行动点 | ||
| </Button> | ||
| } | ||
| wrap | ||
| closeable | ||
| /> | ||
| <br /> | ||
| <NoticeBar | ||
| content="提示文案描述文案描文案" | ||
| description="文案提示描述描述描述" | ||
| tag={<Notice width={12} height={12} />} | ||
| action={ | ||
| <Button size="small" type="primary"> | ||
| 强行动点 | ||
| </Button> | ||
| } | ||
| wrap | ||
| closeable | ||
| /> | ||
| <br /> | ||
| <NoticeBar | ||
| wrap | ||
| content="文案展示字" | ||
| description="最大支持十五个汉字汉字汉字最大支持十五个汉字汉字汉字最大支持十五个汉字汉字汉字" | ||
| tag={<Notice width={12} height={12} />} | ||
| action={<span>弱行动点 ></span>} | ||
| /> | ||
| </> | ||
| ) | ||
| } | ||
| export default Demo12 |
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 |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import React, { useState } from 'react' | ||
| import { NoticeBar, Button } from '@nutui/nutui-react' | ||
|
|
||
| const Demo13 = () => { | ||
| const [visible, setVisible] = useState(true) | ||
|
|
||
| const reset = () => { | ||
| setVisible(false) | ||
| setTimeout(() => setVisible(true), 100) | ||
| } | ||
|
|
||
| return ( | ||
| <> | ||
| {visible && ( | ||
| <NoticeBar | ||
| content="提示文案描述文案描文案" | ||
| description="文案提示描述描述描述" | ||
| action={ | ||
| <Button size="small" type="primary"> | ||
| 强行动点 | ||
| </Button> | ||
| } | ||
| autoClose={5000} | ||
| onClose={() => {}} | ||
| wrap | ||
| /> | ||
| )} | ||
| <br /> | ||
| <Button size="small" onClick={reset}> | ||
| 重新展示 | ||
| </Button> | ||
| </> | ||
| ) | ||
| } | ||
| export default Demo13 |
Oops, something went wrong.
Oops, something went wrong.
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.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Fake timer 恢复应放入 finally,避免测试污染。
Line 409-430 里若任一断言抛错,
vi.useRealTimers()不会执行,后续用例会被 fake timer 污染。建议用try/finally包裹。🔧 建议修复
test('autoClose renders countdown ring and closes after delay', async () => { - vi.useFakeTimers() - const handleClose = vi.fn() - const { container } = render( - <NoticeBar content="自动关闭" autoClose={3000} onClose={handleClose} /> - ) - - expect(container.querySelector('.nut-noticebar-box')).toBeTruthy() - expect( - container.querySelector('.nut-noticebar-box-close-countdown') - ).toBeTruthy() - expect(container.querySelector('.nut-noticebar-box-close-icon')).toBeTruthy() - - act(() => { - vi.advanceTimersByTime(3000) - }) - - expect(container.querySelector('.nut-noticebar-box')).toBeFalsy() - expect(handleClose).toHaveBeenCalled() - - vi.useRealTimers() + vi.useFakeTimers() + try { + const handleClose = vi.fn() + const { container } = render( + <NoticeBar content="自动关闭" autoClose={3000} onClose={handleClose} /> + ) + + expect(container.querySelector('.nut-noticebar-box')).toBeTruthy() + expect( + container.querySelector('.nut-noticebar-box-close-countdown') + ).toBeTruthy() + expect(container.querySelector('.nut-noticebar-box-close-icon')).toBeTruthy() + + act(() => { + vi.advanceTimersByTime(3000) + }) + + expect(container.querySelector('.nut-noticebar-box')).toBeFalsy() + expect(handleClose).toHaveBeenCalled() + } finally { + vi.useRealTimers() + } })🤖 Prompt for AI Agents