Skip to content

Commit

Permalink
Bug fixes.
Browse files Browse the repository at this point in the history
Bug fix for when some validations where wrongly being called on empty
values.
  • Loading branch information
amostajo committed Sep 13, 2016
1 parent 6733a96 commit 540bdc1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion dist/vue.form.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Alejandro Mostajo <http://about.me/amostajo>
* @copyright 10Quality <http://www.10quality.com>
* @license MIT
* @version 1.0.7
* @version 1.0.8
*/
Vue.component('vform', Vue.extend({
props:
Expand Down Expand Up @@ -401,6 +401,7 @@ Vue.component('vform', Vue.extend({
* Validates input.
* @since 1.0.2
* @since 1.0.7 Added equal,required_if,url
* @since 1.0.8 Bug fixes.
*
* @return bool
*/
Expand Down Expand Up @@ -498,6 +499,7 @@ Vue.component('vform', Vue.extend({
case 'email':
var regex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if (this.$parent.request[this.listen] !== undefined
&& this.$parent.request[this.listen].length > 0
&& !regex.test(this.$parent.request[this.listen])
) {
this.addError(options);
Expand Down Expand Up @@ -530,6 +532,7 @@ Vue.component('vform', Vue.extend({
case 'url':
var regex = /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/;
if (this.$parent.request[this.listen] !== undefined
&& this.$parent.request[this.listen].length > 0
&& !regex.test(this.$parent.request[this.listen])
) {
this.addError(options);
Expand Down
2 changes: 1 addition & 1 deletion dist/vue.form.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-form",
"version": "1.0.7",
"version": "1.0.8",
"description": "Form component for Vue JS.",
"main": "dist/vue.social-share.js",
"repository": {
Expand Down
5 changes: 4 additions & 1 deletion src/vue.form.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Alejandro Mostajo <http://about.me/amostajo>
* @copyright 10Quality <http://www.10quality.com>
* @license MIT
* @version 1.0.7
* @version 1.0.8
*/
Vue.component('vform', Vue.extend({
props:
Expand Down Expand Up @@ -401,6 +401,7 @@ Vue.component('vform', Vue.extend({
* Validates input.
* @since 1.0.2
* @since 1.0.7 Added equal,required_if,url
* @since 1.0.8 Bug fixes.
*
* @return bool
*/
Expand Down Expand Up @@ -498,6 +499,7 @@ Vue.component('vform', Vue.extend({
case 'email':
var regex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if (this.$parent.request[this.listen] !== undefined
&& this.$parent.request[this.listen].length > 0
&& !regex.test(this.$parent.request[this.listen])
) {
this.addError(options);
Expand Down Expand Up @@ -530,6 +532,7 @@ Vue.component('vform', Vue.extend({
case 'url':
var regex = /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/;
if (this.$parent.request[this.listen] !== undefined
&& this.$parent.request[this.listen].length > 0
&& !regex.test(this.$parent.request[this.listen])
) {
this.addError(options);
Expand Down

0 comments on commit 540bdc1

Please sign in to comment.