feat(QTM-786): Added "button" type to prevent form submission when opening options list #588
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
https://jirasoftware.catho.com.br/browse/QTM-786
Review guide
How to test
Clone quantum
Edit the stories/DropdownLight/DropdownLight.regrssion-test.story.jsx file
Replace the Template constant with:
const Template = (args) => { const handleOnSubmit = (e) => { e.preventDefault(); console.log('Formulário enviado. Esse não é o comportamento esperado!'); }; return <form onSubmit={handleOnSubmit}><DropdownLight items={itemsObjectMock} {...args} /></form> };
. The idea is that when selecting an item from DropdownLight, no form submission is triggered.Use the node version defined in .nvmrc in the repository root
Run
yarn && yarn test:regression:storybook
In the browser, access http://localhost:9006/ and look for the DropdownLight/Default tests.
Now select an item and see if the form is triggered. If true, the component is still having problems.