-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fix(@rjsf/antd): Check for errors.length #2576
Changes from 3 commits
aea9457
1872dc2
a33d9d8
574cd6d
476eaa5
e452550
7ad506a
aa49009
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you be willing to add this to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. import React from 'react' is already in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure you understand what I mean... You created a new |
||
import renderer from 'react-test-renderer'; | ||
|
||
import '../__mocks__/matchMedia.mock'; | ||
import Form from '../src'; | ||
|
||
const { describe, expect, test } = global; | ||
|
||
describe("array fields", () => { | ||
test("has errors", () => { | ||
const schema = { | ||
type: 'object', | ||
properties: { | ||
name: { | ||
type: 'string', | ||
} | ||
} | ||
}; | ||
const tree = renderer | ||
.create(<Form schema={schema} extraErrors={{ name: { __errors: ["Bad input"] } }} />) | ||
.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
test("no errors", () => { | ||
const schema = { | ||
type: 'object', | ||
properties: { | ||
name: { | ||
type: 'string', | ||
} | ||
} | ||
}; | ||
const tree = renderer | ||
.create(<Form schema={schema} />) | ||
.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
test("empty errors array", () => { | ||
const schema = { | ||
type: 'object', | ||
properties: { | ||
name: { | ||
type: 'string', | ||
} | ||
} | ||
}; | ||
const tree = renderer | ||
.create(<Form schema={schema} extraErrors={{ name: { __errors: [] } }} />) | ||
.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
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.
Can you move this up to the
5.0.0-beta.3
section?