Skip to content
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

Feat/modify file input #11

Merged
merged 3 commits into from
Jul 14, 2023
Merged

Feat/modify file input #11

merged 3 commits into from
Jul 14, 2023

Conversation

fprebolledo
Copy link
Contributor

Context

Banano is a component library intended for use in Platanus projects. The BnFileInput component acts as a file input, allowing the use of v-model. In the initial implementation, this component only accepted a list of files, but did not handle single files.

This PR

This PR enables BnFileInput to accept single files. It handles multiple scenarios, including cases where the value exists as either a File list or a single file, as well as cases where the value does not exist. Additionally, a change has been made to set the "touched" value when the dialog is open. Previously, if the dialog was open but the user didn't select any files, the validation wouldn't appear.

Furthermore, tests have been added to cover all the cases present in the component.

@fprebolledo fprebolledo requested a review from gmq July 7, 2023 22:46
Copy link
Member

@gmq gmq left a comment

Choose a reason for hiding this comment

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

The tests pass but they seem to be throwing a lot of warnings.

stderr | src/components/BnFileInput/BnFiIeInput.spec.ts > BnFileInput > v-model should work with array
[Vue warn]: Unhandled error during execution of native event handler
  at <BnFileInput modelValue= [] onUpdate:modelValue=fn<onUpdate:modelValue> name="image"  ... >
  at <Form onSubmit=fn<bound submit> validation-schema= {} >
  at <Anonymous ref="VTU_COMPONENT" >
  at <VTUROOT>
Error: Uncaught [ReferenceError: DataTransfer is not defined]

src/components/BnFileInput/BnFileInput.vue Outdated Show resolved Hide resolved
src/components/BnFileInput/BnFiIeInput.spec.ts Outdated Show resolved Hide resolved
src/components/BnFileInput/BnFiIeInput.spec.ts Outdated Show resolved Hide resolved
@fprebolledo
Copy link
Contributor Author

@fprebolledo
Copy link
Contributor Author

I had to mock the DataTransfer object, so I created a folder called 'mocks' and inside it, I generated a file with the mocked DataTransfer.

Copy link
Member

@gmq gmq left a comment

Choose a reason for hiding this comment

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

💯

@fprebolledo fprebolledo merged commit e825eac into master Jul 14, 2023
3 checks passed
@fprebolledo fprebolledo deleted the feat/modify-file-input branch July 14, 2023 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants