Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/api-explorer/__tests__/Params.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ test('{ type: string, format: binary } should render as <input type="file">', ()
expect(params.find('.field-file').length).toBe(1);
});

function renderParams(schema) {
function renderParams(schema, customProps) {
return mount(
<div>
<Params
{...props}
{...customProps}
operation={
new Operation(oas, '/path', 'post', {
requestBody: {
Expand Down Expand Up @@ -232,3 +233,13 @@ describe('readOnly', () => {
).toBe(1);
});
});

test('defaults should be applied on first render', done => {
const defaultValue = 'this is a default value';
function onChange(formData) {
expect(formData.body).toEqual({ a: defaultValue });
return done();
}

renderParams({ type: 'string', default: defaultValue }, { onChange });
});
12 changes: 6 additions & 6 deletions packages/api-explorer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.