From aeeb93fc0c8223db89facdca420a3ec39b1588a5 Mon Sep 17 00:00:00 2001 From: Monica Dinculescu Date: Mon, 29 Jun 2015 11:44:07 -0700 Subject: [PATCH] validate should not return undefined --- iron-validatable-behavior.html | 6 +++++- test/iron-validatable-behavior.html | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/iron-validatable-behavior.html b/iron-validatable-behavior.html index c59c47e..a264668 100644 --- a/iron-validatable-behavior.html +++ b/iron-validatable-behavior.html @@ -91,7 +91,11 @@ * @return {boolean} True if `values` is valid. */ validate: function(values) { - var valid = this._validator && this._validator.validate(values); + var valid = true; + if (this.hasValidator()) { + valid = this._validator.validate(values); + } + this.invalid = !valid; return valid; } diff --git a/test/iron-validatable-behavior.html b/test/iron-validatable-behavior.html index 435c034..847a3f8 100644 --- a/test/iron-validatable-behavior.html +++ b/test/iron-validatable-behavior.html @@ -45,6 +45,12 @@ assert.isFalse(node.hasAttribute('aria-invalid'), 'aria-invalid is unset'); }); + test('validate() is true if a validator isn\'t set', function() { + var node = fixture('basic'); + var valid = node.validate(); + assert.isTrue(valid); + }); + });