-
Notifications
You must be signed in to change notification settings - Fork 322
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
skeleton组件问题修复&测试用例完善 #1951
skeleton组件问题修复&测试用例完善 #1951
Conversation
fix delay and loading props and test
> | ||
<div | ||
class="t-skeleton__col t-skeleton--type-text t-skeleton--animation-none" | ||
/> |
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.
这些元素没了,可能是 BUG,仔细确认下
expect(container.querySelector('.t-skeleton__row')).toBeFalsy(); | ||
await mockDelay(1000); | ||
expect(container.querySelector('.t-skeleton__row')).toBeTruthy(); | ||
it('props.delay: show loading delay 10ms', async () => { |
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.
手写的测试用例,放在单独的文件里面
// 骨架屏无需展示 | ||
if (!loading) { | ||
// 加载时长超过delay时,需加载DEFAULT_DURATION时长的骨架屏 | ||
if (delay > 0 && loadingTime.current > delay) { |
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.
这里当loading 变为false 的时候,是否触发 DEFAULT_DURATION 防闪烁效果,需要判断delay > 0 吗?是不是需要包含delay === 0 的情况呢? 按照目前的逻辑,会存在比如: 用户设置了delay 默认为0 ,期望出现骨架屏过渡,而加载时间可能是100ms ,也可能是10ms,10ms 的时候还是会出现闪烁现象的~
🤔 这个 PR 的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
📝 更新日志
☑️ 请求合并前的自查清单