Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
fix: setting a unique idPrefix for all forms to prevent dupe DOM IDs (#…
Browse files Browse the repository at this point in the history
…544)

* fix: setting a unique idPrefix for all forms to prevent dupe DOM IDs

* test: fixing some broken tests
  • Loading branch information
erunion authored Mar 20, 2020
1 parent b88a96b commit b8a5ee2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/api-explorer/__tests__/Params.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ test('additionalProperties object labels (keys) should be editable', () => {
[ADDITIONAL_PROPERTY_FLAG]: true,
});

expect(params.find('input#createPath_a-key')).toHaveLength(1);
expect(params.find('input#body-createPath_a-key')).toHaveLength(1);
});

test('if no operationId is present, one should be generated', () => {
Expand Down Expand Up @@ -414,7 +414,7 @@ describe('readOnly', () => {
<div>
<Params {...props} operation={oas.operation('/pet', 'post')} />
</div>
).find('input#addPet_id[type="hidden"]')
).find('input#body-addPet_id[type="hidden"]')
).toHaveLength(1);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/api-explorer/src/Params.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function Params({
}}
formData={formData[schema.type]}
id={`form-${schema.type}-${operationId}`}
idPrefix={operationId}
idPrefix={`${schema.type}-${operationId}`}
onChange={form => {
return onChange({ [schema.type]: form.formData });
}}
Expand Down

0 comments on commit b8a5ee2

Please sign in to comment.