Repository: baianat/vee-validate
Pull request #1991 (2019-04-04 17:02:43)

fix ru locale grammatical case
🔎 __Overview__

This PR changes the ru locale `decimal` messages style because: it's wrong grammatical case if there is no digits

✔ __Issues affected__
nope


codecov[bot]: # [Codecov](https://codecov.io/gh/baianat/vee-validate/pull/1991?src=pr&el=h1) Report
> Merging [#1991](https://codecov.io/gh/baianat/vee-validate/pull/1991?src=pr&el=desc) into [master](https://codecov.io/gh/baianat/vee-validate/commit/1f3e840be4022e136f2613d5f339cb97754b8db8?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/baianat/vee-validate/pull/1991/graphs/tree.svg?width=650&token=XFzlvHKFP5&height=150&src=pr)](https://codecov.io/gh/baianat/vee-validate/pull/1991?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #1991   +/-   ##
=======================================
  Coverage   95.98%   95.98%           
=======================================
  Files          62       62           
  Lines        2341     2341           
  Branches      729      729           
=======================================
  Hits         2247     2247           
  Misses         85       85           
  Partials        9        9
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/baianat/vee-validate/pull/1991?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/baianat/vee-validate/pull/1991?src=pr&el=footer). Last update [1f3e840...9aa4afa](https://codecov.io/gh/baianat/vee-validate/pull/1991?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/docs/guide/components/validation-provider.md b/docs/guide/components/validation-provider.md
index a59555e3..c25c9f82 100644
--- a/docs/guide/components/validation-provider.md
+++ b/docs/guide/components/validation-provider.md
@@ -393,6 +393,7 @@ Those are the only methods meant for public usage, other methods that may exist
 | validateSilent | `void`  | `Promise<ValidationResult>` | Runs a validation of the current value against the rules defined. __does not mutate the validation state.__  |
 | applyResult | `ValidationResult` | `void`           | Takes a __validation result__ object and applies it on the current state.                                   |
 | reset       | `void`  | `void`                      | Resets validation state.                                                                                    |
+| setFlags    | Object | void | Updates the field flag states with an object, the object properties should be the flag names and the values should be boolean values. |
 
 ### Events
 
diff --git a/locale/pt_BR.js b/locale/pt_BR.js
index cb1d9804..3718af1e 100644
--- a/locale/pt_BR.js
+++ b/locale/pt_BR.js
@@ -23,6 +23,7 @@ const messages = {
   included: (field) => `O campo ${field} deve ter um valor válido.`,
   integer: (field) => `O campo ${field} deve ser um número inteiro.`,
   ip: (field) => `O campo ${field} deve ser um endereço IP válido.`,
+  is: (field) => `O valor inserido no campo ${field} não é válido.`,
   length: (field, [length, max]) => {
     if (max) {
       return `O tamanho do campo ${field} está entre ${length} e ${max}.`;
diff --git a/locale/pt_PT.js b/locale/pt_PT.js
index ba61481b..cf45c7f5 100644
--- a/locale/pt_PT.js
+++ b/locale/pt_PT.js
@@ -21,6 +21,7 @@ const messages = {
   image: (field) => `O campo ${field} deve ser uma imagem.`,
   included: (field) => `O campo ${field} deve ter um valor válido.`,
   ip: (field) => `O campo ${field} deve ser um endereço IP válido.`,
+  is: (field) => `O valor inserido no campo ${field} não é válido.`,
   max: (field, [length]) => `O campo ${field} não deve ter mais que ${length} caracteres.`,
   max_value: (field, [max]) => `O campo ${field} precisa ser ${max} ou menor.`,
   mimes: (field) => `O campo ${field} deve ser um tipo de ficheiro válido.`,
diff --git a/locale/ru.js b/locale/ru.js
index b1c9210e..949d8fff 100644
--- a/locale/ru.js
+++ b/locale/ru.js
@@ -13,7 +13,7 @@ const messages = {
   credit_card: (field) => `Поле ${field} должно быть действительным номером карты`,
   date_between: (field, [min, max]) => `Поле ${field} должно быть между ${min} и ${max}.`,
   date_format: (field, [format]) => `Поле ${field} должно быть в формате ${format}.`,
-  decimal: (field, [decimals = '*'] = []) => `Поле ${field} должно быть числовым и может содержать${decimals === '*' ? '' : ' ' + decimals} десятичных числа.`,
+  decimal: (field, [decimals = '*'] = []) => `Поле ${field} должно быть числовым и может содержать${decimals === '*' ? ' десятичные числа' : ' ' + decimals + ' десятичных чисел'}.`,
   digits: (field, [length]) => `Поле ${field} должно быть числовым и точно содержать ${length} цифры.`,
   dimensions: (field, [width, height]) => `Поле ${field} должно быть ${width} пикселей на ${height} пикселей.`,
   email: (field) => `Поле ${field} должно быть действительным электронным адресом.`,
diff --git a/src/modes.js b/src/modes.js
index 581c3a5b..a2acb87a 100644
--- a/src/modes.js
+++ b/src/modes.js
@@ -14,7 +14,7 @@ const eager = ({ errors }) => {
   }
 
   return {
-    on: ['change']
+    on: ['change', 'blur']
   };
 };
 
diff --git a/src/utils/index.js b/src/utils/index.js
index e642eef6..a6118b6e 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -544,19 +544,19 @@ export const fillRulesFromElement = (el: HTMLInputElement, rules: string | { [st
     const timeFormat = el.step && Number(el.step) < 60 ? 'HH:mm:ss' : 'HH:mm';
 
     if (el.type === 'date') {
-      return appendRule('date_format:YYYY-MM-DD', rules);
+      return appendRule('date_format:yyyy-MM-dd', rules);
     }
 
     if (el.type === 'datetime-local') {
-      return appendRule(`date_format:YYYY-MM-DDT${timeFormat}`, rules);
+      return appendRule(`date_format:yyyy-MM-ddT${timeFormat}`, rules);
     }
 
     if (el.type === 'month') {
-      return appendRule('date_format:YYYY-MM', rules);
+      return appendRule('date_format:yyyy-MM', rules);
     }
 
     if (el.type === 'week') {
-      return appendRule('date_format:YYYY-[W]WW', rules);
+      return appendRule('date_format:yyyy-[W]WW', rules);
     }
 
     if (el.type === 'time') {
diff --git a/src/utils/vnode.js b/src/utils/vnode.js
index bc58e254..13da33f7 100644
--- a/src/utils/vnode.js
+++ b/src/utils/vnode.js
@@ -111,8 +111,8 @@ export function getInputEventName (vnode, model) {
     return event;
   }
 
-  // Lazy Models typically use change event
-  if (model && model.modifiers && model.modifiers.lazy) {
+  // Lazy Models and select tag typically use change event
+  if ((model && model.modifiers && model.modifiers.lazy) || vnode.tag === 'select') {
     return 'change';
   }
 


Test patch:
diff --git a/tests/unit/resolver.js b/tests/unit/resolver.js
index 778a6831..6a845105 100644
--- a/tests/unit/resolver.js
+++ b/tests/unit/resolver.js
@@ -98,16 +98,16 @@ describe('resolves the rules', () => {
     expect(resolve(input)).toEqual({ min_value: ['10'], max_value: ['20'], decimal: [] });
 
     input.type = 'date';
-    expect(resolve(input)).toEqual({ date_format: ['YYYY-MM-DD'] });
+    expect(resolve(input)).toEqual({ date_format: ['yyyy-MM-dd'] });
 
     input.type = 'datetime-local';
-    expect(resolve(input)).toEqual({ date_format: ['YYYY-MM-DDTHH:mm'] });
+    expect(resolve(input)).toEqual({ date_format: ['yyyy-MM-ddTHH:mm'] });
 
     input.type = 'week';
-    expect(resolve(input)).toEqual({ date_format: ['YYYY-[W]WW'] });
+    expect(resolve(input)).toEqual({ date_format: ['yyyy-[W]WW'] });
 
     input.type = 'month';
-    expect(resolve(input)).toEqual({ date_format: ['YYYY-MM'] });
+    expect(resolve(input)).toEqual({ date_format: ['yyyy-MM'] });
 
     input.type = 'time';
     expect(resolve(input)).toEqual({ date_format: ['HH:mm'] });