Repository: baianat/vee-validate
Pull request #913 (2017-10-25 13:08:52)

change
add jsDeliver hits badge and create condust.md


Patch:
diff --git a/CONDUCT.md b/CONDUCT.md
new file mode 100644
index 00000000..e2dbaeee
--- /dev/null
+++ b/CONDUCT.md
@@ -0,0 +1,46 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at logaretm1@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/README.md b/README.md
index c67553e9..ff8a18e0 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,7 @@ yarn add vee-validate
 
 vee-validate is also available on these cdns:
 
-- [jsdelivr cdn](https://cdn.jsdelivr.net/npm/vee-validate@latest/dist/vee-validate.js)
+- [jsdelivr cdn](https://cdn.jsdelivr.net/npm/vee-validate@latest/dist/vee-validate.js) [![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/vee-validate/badge?style=rounded)](https://www.jsdelivr.com/package/npm/vee-validate)
 - [unpkg](https://unpkg.com/vee-validate)
 
 ### Getting Started
diff --git a/locale/eu.js b/locale/eu.js
new file mode 100644
index 00000000..4f6fc68f
--- /dev/null
+++ b/locale/eu.js
@@ -0,0 +1,61 @@
+import { formatFileSize, isDefinedGlobally } from './utils';
+
+const messages = {
+  _default: (field) => `${field} baliogabea da.`,
+  after: (field, [target, inclusion]) => `${field}(e)k honen ondoren egon behar du ${inclusion ? 'edo honen berdina izan ' : ''}${target}.`,
+  alpha_dash: (field) => `${field} eremuak karaktere alfanumerikoak, marrak eta azpimarrak eduki ditzake.`,
+  alpha_num: (field) => `${field} eremuak soilik karaktere alfanumerikoak eduki ditzake.`,
+  alpha_spaces: (field) => `${field} eremuak soilik karaktere alfanumerikoak eta zuriuneak eduki ditzake.`,
+  alpha: (field) => `${field} eremuak soilik karaktere alfabetikoak eduki ditzake.`,
+  before: (field, [target, inclusion]) => `${field}(e)k honen aurretik egon behar du ${inclusion ? 'edo honen berdina izan ' : ''}${target}.`,
+  between: (field, [min, max]) => `${field} eremuak ${min} eta ${max} artean egon behar du.`,
+  confirmed: (field) => `${field} berrespenak ez datoz bat.`,
+  credit_card: (field) => `${field} eremua baliogabea da.`,
+  date_between: (field, [min, max]) => `${field}(e)k ${min} eta ${max} artean egon behar du.`,
+  date_format: (field, [format]) => `${field}(e)k ${format} formatuan egon behar du.`,
+  decimal: (field, [decimals] = ['*']) => `${field} eremuak zenbakizkoa izan behar du eta ${!decimals || decimals === '*' ? '' : decimals} dezimal izan ditzake.`,
+  digits: (field, [length]) => `${field} eremuak zenbakizkoa izan behar du eta zehazki ${length} digitu izan behar ditu.`,
+  dimensions: (field, [width, height]) => `${field} eremuak ${width} pixel bider ${height} pixel izan behar du.`,
+  email: (field) => `${field} eremuak baliozko helbide elektroniko bat izan behar du.`,
+  ext: (field) => `${field} eremuak baliozko fitxategi bat izan behar du.`,
+  image: (field) => `${field} eremuak irudi bat izan behar du.`,
+  in: (field) => `${field} eremuak baliozko balio bat izan behar du.`,
+  integer: (field) => `${field} eremuak zenbaki oso bat izan behar du.`,
+  ip: (field) => `${field} eremuak baliozko IP helbide bat izan behar du.`,
+  length: (field, [length, max]) => {
+    if (max) {
+      return `${field}(r)en luzerak ${length} eta ${max} artean egon behar du.`;
+    }
+
+    return `${field}(r)en luzerak ${length} izan behar du.`;
+  },
+  max: (field, [length]) => `${field} eremuak ezin ditu ${length} karaktere baino gehiago izan.`,
+  max_value: (field, [max]) => `${field} eremuak ${max} edo gutxiago izan behar du.`,
+  mimes: (field) => `${field} eremuak baliozko fitxategi-mota bat izan behar du.`,
+  min: (field, [length]) => `${field} eremuak gutxienez ${length} karaktere izan behar ditu.`,
+  min_value: (field, [min]) => `${field} eremuak ${min} edo gehiago izan behar du.`,
+  not_in: (field) => `${field} eremuak baliozko balio bat izan behar du.`,
+  numeric: (field) => `${field} eremuak zenbakizko karaktereak soilik izan ditzake.`,
+  regex: (field) => `${field} eremuaren formatua baliogabea da.`,
+  required: (field) => `${field} eremua derrigorrezkoa da.`,
+  size: (field, [size]) => `${field}(e)n tamainak ${formatFileSize(size)} baino txikiagoa izan behar du.`,
+  url: (field) => `${field} eremua ez da baliozko URL bat.`
+};
+
+// You can ignore this export, locale maintainer!
+export {
+  messages
+};
+
+const locale = {
+  name: 'eu',
+  messages,
+  attributes: {}
+};
+
+if (isDefinedGlobally()) {
+  // eslint-disable-next-line
+  VeeValidate.Validator.addLocale(locale);
+}
+
+export default locale;
diff --git a/locale/id.js b/locale/id.js
index ab473e7d..0c921998 100644
--- a/locale/id.js
+++ b/locale/id.js
@@ -1,13 +1,16 @@
 import { formatFileSize, isDefinedGlobally } from './utils';
 
 const messages = {
+  _default: (field) => `Nilai ${field} tidak sah.`,
   after: (field, [target]) => `${field} harus sebelum ${target}.`,
   alpha_dash: (field) => `${field} boleh mengandung karakter alfanumerik, tanda hubung, dan garis bawah.`,
   alpha_num: (field) => `${field} hanya boleh mengandung karakter alfanumerik.`,
+  alpha_spaces: (field) => `${field} hanya boleh berisi karakter alfabet serta spasi.`,
   alpha: (field) => `${field} hanya boleh mengandung karakter alfabet.`,
   before: (field, [target]) => `${field} harus setelah ${target}.`,
   between: (field, [min, max]) => `${field} harus di antara ${min} dan ${max}.`,
   confirmed: (field, [confirmedField]) => `${field} tidak cocok dengan ${confirmedField}.`,
+  credit_card: (field) => `${field} tidak sah.`,
   date_between: (field, [min, max]) => `${field} harus di antara ${min} dan ${max}.`,
   date_format: (field, [format]) => `${field} harus dalam format ${format}.`,
   decimal: (field, [decimals] = ['*']) => `${field} harus berupa angka dan boleh mengandung ${decimals === '*' ? '' : decimals} titik desimal.`,
@@ -17,7 +20,15 @@ const messages = {
   ext: (field) => `${field} harus berupa berkas yang benar.`,
   image: (field) => `${field} harus berupa gambar.`,
   in: (field) => `${field} harus berupa nilai yang sah.`,
+  integer: (field) => `${field} harus berupa bilangan bulat.`,
   ip: (field) => `${field} harus berupa alamat ip yang sah.`,
+  length: (field, [length, max]) => {
+    if (max) {
+      return `Panjang ${field} harus di antara ${length} dan ${max}.`;
+    }
+
+    return `Panjang ${field} harus tepat ${length}.`;
+  },
   max: (field, [length]) => `${field} tidak boleh lebih dari ${length} karakter.`,
   max_value: (field, [size]) => `Nilai ${field} tidak boleh lebih dari ${size}.`,
   mimes: (field) => `Tipe berkas ${field} harus benar.`,
diff --git a/locale/nl.js b/locale/nl.js
index dfed95e1..fdaa6798 100644
--- a/locale/nl.js
+++ b/locale/nl.js
@@ -3,7 +3,7 @@ import { formatFileSize, isDefinedGlobally } from './utils';
 const messages = {
   _default: (field) => `${field} waarde is ongeldig.`,
   after: (field, [target, inclusion]) => `${field} moet later zijn dan ${inclusion ? 'of gelijk aan ' : ''}${target}.`,
-  alpha_dash: (field) => `${field} mag alleen letters, nummers, en strepen bevatten.`,
+  alpha_dash: (field) => `${field} mag alleen letters, nummers, en streepjes bevatten.`,
   alpha_num: (field) => `${field} mag alleen letters en nummers bevatten.`,
   alpha_spaces: (field) => `${field} mag alleen letters en spaties bevatten.`,
   alpha: (field) => `${field} mag alleen letters bevatten.`,
@@ -20,9 +20,9 @@ const messages = {
   ext: (field) => `${field} moet een geldig bestand zijn.`,
   image: (field) => `${field} moet een afbeelding zijn.`,
   in: (field) => `${field} moet een geldige waarde zijn.`,
-  ip: (field) => `${field} moet een geldig ip adres zijn.`,
+  ip: (field) => `${field} moet een geldig IP-adres zijn.`,
   max: (field, [length]) => `${field} mag niet groter zijn dan ${length} karakters.`,
-  max_value: (field, [max]) => `${field} moet maximaal ${max} zijn.`,
+  max_value: (field, [max]) => `${field} mag maximaal ${max} zijn.`,
   mimes: (field) => `${field} moet een geldig bestandstype hebben.`,
   min: (field, [length]) => `${field} moet minimaal ${length} karakters zijn.`,
   min_value: (field, [min]) => `${field} moet minimaal ${min} zijn.`,
diff --git a/src/core/field.js b/src/core/field.js
index e84a2e20..93c8c248 100644
--- a/src/core/field.js
+++ b/src/core/field.js
@@ -219,9 +219,8 @@ export default class Field {
 
     this.addActionListeners();
     this.updateClasses();
-    if (this.validator.errors && isCallable(this.validator.errors.removeById)) {
-      this.validator.errors.removeById(this.id);
-    }
+    this.updateAriaAttrs();
+    this.updateCustomValidity();
   }
 
   /**


Test patch:
diff --git a/tests/field.js b/tests/field.js
index 5e9ac53d..a334c4cd 100644
--- a/tests/field.js
+++ b/tests/field.js
@@ -538,6 +538,9 @@ test('set field custom validity if possible', () => {
 });
 
 test('resets field state', () => {
+  const el = document.createElement('input');
+  el.type = 'text';
+  el.name = 'field';
   const vm = {
     $validator: {
       errors: {
@@ -545,12 +548,13 @@ test('resets field state', () => {
       }
     }
   };
-  const field = new Field(null, { vm });
+  const field = new Field(el, { vm });
   field.flags.valid = true;
+  field.el.setAttribute('aria-invalid', 'true');
 
   field.reset();
   expect(field.flags.valid).toBe(null);
-  expect(vm.$validator.errors.removeById).toHaveBeenCalledWith(field.id);
+  expect(field.el.getAttribute('aria-invalid')).toBe('false');
 });
 
 test('sets the field flags', () => {