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

Size prop documentation - [Vue warn]: Invalid prop: custom validator check failed for prop "size" #50

Open
2 of 3 tasks
avrtau opened this issue Sep 22, 2021 · 4 comments

Comments

@avrtau
Copy link

avrtau commented Sep 22, 2021

Please check all that apply

  • visual bug
  • functional bug
  • able to consistently reproduce

Expected Behavior

Component should set the flag size without showing Vue warnings

Current Behavior

[Vue warn]: Invalid prop: custom validator check failed for prop "size"

Possible Solution

The documentation shows "L', "M", "S" (all upper-case) as possible values for the size prop, however the validator checks for lower-case letters:

Flag.vue: line 32

28: size: {
29:   type: String,
30:   default: 'm',
31:   validator: value => (
32:     ['s', 'm', 'l'].indexOf(value) !== -1
33:   ),
34: }

There are two possible solutions:

  1. Change the documentation to reflect the fact that only lower-case values are accepted
  2. Change the validator to accept upper-case letters as well, either by adding the upper-case letters to the array: ['s', 'm', 'l', 'S', 'M', 'L'], or, by changing the input value to lower-case ['s', 'm', 'l'].indexOf(('' + value).toLowerCase())

Steps to Reproduce

  1. Set the flag size value as a capital S: <v-flag code="US" size="S" />

Logs

vue.runtime.esm.js?2b0e:619 [Vue warn]: Invalid prop: custom validator check failed for prop "size".
found in
---> <Flag>
       <VForm>
         <VCard>
           <Pages/user/profile.vue> at pages/user/profile.vue
             <Nuxt>
               <VMain>
                 <VApp>
                   <Default> at layouts/default.vue
                     <Root>

Your Environment

  • Version used: 1.0.1
  • Browser Name and version: Chrome Version 91.0.4472.114 (Official Build) (x86_64)
  • Operating System and version (desktop or mobile): MacOS desktop
@daoneandonly
Copy link
Contributor

Thanks for your thoughts on vue-flagpack! I've added these changes in #51 and will be part of the next release. I've also made a note to change the values for size variables to lowercase in the docs. Expect to see these changes happening in the near feature.

@dudintv
Copy link

dudintv commented Feb 15, 2022

I've just encountered this issue and spent some time finding the solution...
Maybe you can just change the documentation from 'S', 'M', 'L' to 's', 'm', 'l'?

@nazar1ua
Copy link

Maybe the best solution is to:

28: size: {
29:   type: String,
30:   default: 'm',
31:   validator: value => (
32:     ['s', 'm', 'l'].indexOf(value.toLowerCase()) !== -1
33:   ),
34: }

@nazar1ua
Copy link

I will add it to pr #63

nazar1ua added a commit to nazar1ua/vue-flagpack that referenced this issue Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants