Comparing version 1.0.0-rc.5 to 1.0.0-rc.6
@@ -30,2 +30,10 @@ "use strict"; | ||
// Field's scoped error message | ||
}, { | ||
key: "getErrorMessage", | ||
value: function getErrorMessage(name, error) { | ||
return this.schema.getErrorMessage(name, error); | ||
} | ||
// All error messages from error | ||
@@ -90,3 +98,3 @@ | ||
value: function check(schema) { | ||
return schema && schema.getError && schema.getErrorMessages && schema.getField && schema.getInitialValue && schema.getProps && schema.getSubfields && schema.getType && schema.getValidator; | ||
return schema && schema.getError && schema.getErrorMessage && schema.getErrorMessages && schema.getField && schema.getInitialValue && schema.getProps && schema.getSubfields && schema.getType && schema.getValidator; | ||
} | ||
@@ -93,0 +101,0 @@ }]); |
@@ -65,2 +65,12 @@ 'use strict'; | ||
}, { | ||
key: 'getErrorMessage', | ||
value: function getErrorMessage(name, error) { | ||
var scopedError = this.getError(name, error); | ||
if (scopedError) { | ||
return this.schema.messageForError(scopedError.type, scopedError.name, null, scopedError.details && scopedError.details.value); | ||
} | ||
return ''; | ||
} | ||
}, { | ||
key: 'getErrorMessages', | ||
@@ -67,0 +77,0 @@ value: function getErrorMessages(error) { |
@@ -135,2 +135,4 @@ 'use strict'; | ||
var errorMessage = context.schema.getErrorMessage(name, context.error); | ||
var label = props.label ? props.label === true ? schemaProps.label : props.label : props.label === null ? null : ''; | ||
@@ -166,2 +168,3 @@ | ||
error: error, | ||
errorMessage: errorMessage, | ||
field: field, | ||
@@ -168,0 +171,0 @@ fields: fields, |
{ | ||
"name": "uniforms", | ||
"version": "1.0.0-rc.5", | ||
"version": "1.0.0-rc.6", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "jsnext:main": "src/index.js", |
@@ -11,2 +11,3 @@ export default class Bridge { | ||
schema.getError && | ||
schema.getErrorMessage && | ||
schema.getErrorMessages && | ||
@@ -27,2 +28,7 @@ schema.getField && | ||
// Field's scoped error message | ||
getErrorMessage (name, error) { | ||
return this.schema.getErrorMessage(name, error); | ||
} | ||
// All error messages from error | ||
@@ -29,0 +35,0 @@ getErrorMessages (error) { |
@@ -55,2 +55,17 @@ import Bridge from './Bridge'; | ||
getErrorMessage (name, error) { | ||
let scopedError = this.getError(name, error); | ||
if (scopedError) { | ||
return this.schema.messageForError( | ||
scopedError.type, | ||
scopedError.name, | ||
null, | ||
scopedError.details && | ||
scopedError.details.value | ||
); | ||
} | ||
return ''; | ||
} | ||
getErrorMessages (error) { | ||
@@ -57,0 +72,0 @@ return (error && error.details || []).map(error => this.schema.messageForError( |
@@ -93,2 +93,4 @@ import get from 'lodash.get'; | ||
const errorMessage = context.schema.getErrorMessage(name, context.error); | ||
const label = props.label | ||
@@ -128,2 +130,3 @@ ? props.label === true | ||
error, | ||
errorMessage, | ||
field, | ||
@@ -130,0 +133,0 @@ fields, |
@@ -81,3 +81,5 @@ import React from 'react'; | ||
messageForError () {}, | ||
messageForError () { | ||
return 'CorrectErrorMessage'; | ||
}, | ||
@@ -208,2 +210,6 @@ objectKeys (name) { | ||
it('have correct `errorMessage`', () => { | ||
expect(props).to.have.property('errorMessage', 'CorrectErrorMessage'); | ||
}); | ||
it('have correct `field`', () => { | ||
@@ -210,0 +216,0 @@ expect(props).to.have.property('field').that.is.an('object'); |
@@ -13,2 +13,3 @@ import React from 'react'; | ||
getError: () => {}, | ||
getErrorMessage: () => {}, | ||
getErrorMessages: () => {}, | ||
@@ -15,0 +16,0 @@ getField: () => ({type: String}), |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
116045
2659