Repository: baianat/vee-validate
Pull request #2122 (2019-06-08 17:26:31)

docs: add missing separator param for decimal rule
🔎 __Overview__

This documentation PR adds a missing "separator" param for the decimal rule.

codecov[bot]: # [Codecov](https://codecov.io/gh/baianat/vee-validate/pull/2122?src=pr&el=h1) Report
> Merging [#2122](https://codecov.io/gh/baianat/vee-validate/pull/2122?src=pr&el=desc) into [master](https://codecov.io/gh/baianat/vee-validate/commit/bd5d43e45e1a42b3d3a8679bb5770a459dbb3c2f?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/2122/graphs/tree.svg?width=650&token=XFzlvHKFP5&height=150&src=pr)](https://codecov.io/gh/baianat/vee-validate/pull/2122?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #2122   +/-   ##
=======================================
  Coverage   95.59%   95.59%           
=======================================
  Files          62       62           
  Lines        2382     2382           
  Branches      749      749           
=======================================
  Hits         2277     2277           
  Misses         94       94           
  Partials       11       11
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/baianat/vee-validate/pull/2122?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/2122?src=pr&el=footer). Last update [bd5d43e...025f1d5](https://codecov.io/gh/baianat/vee-validate/pull/2122?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/docs/guide/rules.md b/docs/guide/rules.md
index 89212151..1eab8ce2 100644
--- a/docs/guide/rules.md
+++ b/docs/guide/rules.md
@@ -229,6 +229,7 @@ The field under validation must be numeric and may contain the specified amount
 ### decimal params
 
 - `decimals:` The maximum allowed number of decimal point numbers. Not passing the decimals will accept numeric data which may or may not contain decimal point numbers.
+- `separator:` Character used to separate the integer from the fractional part of the number
 
 <input v-validate="'decimal:3'" :class="{'input': true, 'is-danger': errors.has('decimal_field') }" name="decimal_field" type="text" placeholder="Numeric value with decimals">
 <span v-show="errors.has('decimal_field')" class="help is-danger">{{ errors.first('decimal_field') }}</span>
diff --git a/src/localization/default.js b/src/localization/default.js
index 94333026..174d28b4 100644
--- a/src/localization/default.js
+++ b/src/localization/default.js
@@ -111,6 +111,10 @@ export default class Dictionary implements IDictionary {
         attributes: {}
       };
     }
+    
+    if (!this.container[locale].messages) {
+      this.container[locale].messages = {}
+    }
 
     this.container[locale].messages[key] = message;
   }
diff --git a/types/vee-validate.d.ts b/types/vee-validate.d.ts
index 8f4ad33f..8ef98926 100644
--- a/types/vee-validate.d.ts
+++ b/types/vee-validate.d.ts
@@ -478,8 +478,10 @@ export class Validator {
 export class ExtendOptions {
     hasTarget?: boolean;
     paramNames?: string[];
-    computesRequired?: Boolean
-    initial?: Boolean
+    computesRequired?: boolean;
+    initial?: boolean;
+    immediate?: boolean;
+    isDate?: boolean;
 }
 
 /**
diff --git a/types/vue.d.ts b/types/vue.d.ts
index f6838cf1..8eb4116d 100644
--- a/types/vue.d.ts
+++ b/types/vue.d.ts
@@ -3,7 +3,7 @@
  */
 
 import Vue, { ComponentOptions } from 'vue';
-import { ErrorBag, FieldFlagsBag, Validator, VeeValidateComponentOptions } from './vee-validate.d';
+import { Validator, VeeValidateComponentOptions } from './vee-validate.d';
 
 declare module 'vue/types/options' {
   interface ComponentOptions<V extends Vue> {


Test patch:
diff --git a/tests/unit/localization/default.js b/tests/unit/localization/default.js
index c4700a7c..9df5c548 100644
--- a/tests/unit/localization/default.js
+++ b/tests/unit/localization/default.js
@@ -70,6 +70,17 @@ test('can set messages', () => {
   expect(dict.getMessage('en', 'winter')).toBe('Winter is coming');
 });
 
+test('can set messages when no messages present', () => {
+  const dict = new Dictionary();
+  dict.merge({
+    'nl': {}
+  });
+
+  dict.setMessage('nl', 'winter', 'De winter komt er aan');
+
+  expect(dict.getMessage('nl', 'winter')).toBe('De winter komt er aan');
+});
+
 test('can set attributes', () => {
   const dict = new Dictionary({
     en: {