Skip to content

Conversation

fireairforce
Copy link
Contributor

@fireairforce
Copy link
Contributor Author

等下补个测试~

@codecov
Copy link

codecov bot commented Aug 5, 2020

Codecov Report

Merging #177 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           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           
Impacted Files Coverage Δ
src/List.tsx 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a966e7b...54c3693. Read the comment docs.

src/List.tsx Outdated
*/
const operations: ListOperations = {
add: defaultValue => {
add: (defaultValue, index: number) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index? :

Copy link
Contributor Author

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'],
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

测试里添加一下校验失败的值,add后确保一下位置不会错

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,这个在 validate 那组测试里面单独加了~

operation.add('1', 2);
});
act(() => {
operation.add('2', -1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里容易让人误解,感觉需要加一个 warning,它只允许有效的正数。

Copy link
Contributor Author

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',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加一个测试用例

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,已经补上去了~

@zombieJ zombieJ merged commit 324d0f5 into react-component:master Aug 7, 2020
@zombieJ
Copy link
Member

zombieJ commented Aug 7, 2020

+ rc-field-form@1.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants