Skip to content

Commit

Permalink
feat(breeze): further development
Browse files Browse the repository at this point in the history
Fixed the UX where an invalid breeze property validation is overwritten if normal rules are valid.
  • Loading branch information
janvanderhaegen committed Apr 26, 2015
1 parent 09f090f commit 772f332
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion dist/amd/validation/validation-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ define(['exports', '../validation/validation-group-builder', '../validation/vali
this.onPropertyValidate(function (propertyBindingPath) {
_this2.passes(function () {
breezeEntity.entityAspect.validateProperty(propertyBindingPath);
return true;
var errors = breezeEntity.entityAspect.getValidationErrors(propertyBindingPath);
if (errors.length === 0) return true;else return errors[0].errorMessage;
});
});
this.onValidate(function () {
Expand Down
3 changes: 2 additions & 1 deletion dist/commonjs/validation/validation-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ var ValidationGroup = (function () {
this.onPropertyValidate(function (propertyBindingPath) {
_this2.passes(function () {
breezeEntity.entityAspect.validateProperty(propertyBindingPath);
return true;
var errors = breezeEntity.entityAspect.getValidationErrors(propertyBindingPath);
if (errors.length === 0) return true;else return errors[0].errorMessage;
});
});
this.onValidate(function () {
Expand Down
6 changes: 5 additions & 1 deletion dist/es6/validation/validation-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ export class ValidationGroup {
this.onPropertyValidate( (propertyBindingPath) => {
this.passes( () => {
breezeEntity.entityAspect.validateProperty(propertyBindingPath);
return true;
var errors = breezeEntity.entityAspect.getValidationErrors(propertyBindingPath);
if(errors.length === 0)
return true;
else
return errors[0].errorMessage;
});
});
this.onValidate( () => {
Expand Down
3 changes: 2 additions & 1 deletion dist/system/validation/validation-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ System.register(['../validation/validation-group-builder', '../validation/valida
this.onPropertyValidate(function (propertyBindingPath) {
_this2.passes(function () {
breezeEntity.entityAspect.validateProperty(propertyBindingPath);
return true;
var errors = breezeEntity.entityAspect.getValidationErrors(propertyBindingPath);
if (errors.length === 0) return true;else return errors[0].errorMessage;
});
});
this.onValidate(function () {
Expand Down
6 changes: 5 additions & 1 deletion src/validation/validation-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ export class ValidationGroup {
this.onPropertyValidate( (propertyBindingPath) => {
this.passes( () => {
breezeEntity.entityAspect.validateProperty(propertyBindingPath);
return true;
var errors = breezeEntity.entityAspect.getValidationErrors(propertyBindingPath);
if(errors.length === 0)
return true;
else
return errors[0].errorMessage;
});
});
this.onValidate( () => {
Expand Down

0 comments on commit 772f332

Please sign in to comment.