-
-
Notifications
You must be signed in to change notification settings - Fork 278
feat: add() support index param #177
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
Conversation
等下补个测试~ |
Codecov Report
@@ Coverage Diff @@
## master #177 +/- ##
=======================================
Coverage 99.88% 99.88%
=======================================
Files 13 13
Lines 902 909 +7
Branches 199 194 -5
=======================================
+ Hits 901 908 +7
Misses 1 1
Continue to review full report at Codecov.
|
src/List.tsx
Outdated
*/ | ||
const operations: ListOperations = { | ||
add: defaultValue => { | ||
add: (defaultValue, index: number) => { |
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.
index? :
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.
ok
expect(getList().find(Field).length).toEqual(5); | ||
expect(form.getFieldsValue()).toEqual({ | ||
list: ['0', undefined, '1', '4', '2'], | ||
}); |
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.
测试里添加一下校验失败的值,add后确保一下位置不会错
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.
ok,这个在 validate 那组测试里面单独加了~
fef3bfa
to
7d89f90
Compare
operation.add('1', 2); | ||
}); | ||
act(() => { | ||
operation.add('2', -1); |
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.
这里容易让人误解,感觉需要加一个 warning,它只允许有效的正数。
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.
ok~
src/List.tsx
Outdated
) { | ||
warning( | ||
false, | ||
'The second parameter of the add function should be a valid positive number', |
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.
加一个测试用例
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.
好的,已经补上去了~
|
ref issue:ant-design/ant-design#26012