Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #10 from PolymerElements/undefined-is-the-worst
Browse files Browse the repository at this point in the history
validate should not return undefined
  • Loading branch information
notwaldorf committed Jun 30, 2015
2 parents a4fc340 + aeeb93f commit 3688f44
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion iron-validatable-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions test/iron-validatable-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

});

</script>
Expand Down

0 comments on commit 3688f44

Please sign in to comment.