diff --git a/src/property_validator.coffee b/src/property_validator.coffee index 3a9e2a4..03d34ef 100644 --- a/src/property_validator.coffee +++ b/src/property_validator.coffee @@ -2,7 +2,7 @@ # ------------------ module.exports = class PropertyValidator - termRegex = /\w[\w ]*\w/g + termRegex = /[^, ][^,]*[^, ]/g # @params # - inputString { String } Validation String. E.g. 'string, optional' diff --git a/test/specs/jscheme_spec.coffee b/test/specs/jscheme_spec.coffee index 7bf87e2..800696f 100644 --- a/test/specs/jscheme_spec.coffee +++ b/test/specs/jscheme_spec.coffee @@ -230,6 +230,23 @@ describe 'jscheme', -> expect(isValid).to.equal(false) + describe 'a validator with dashes in its name', -> + + beforeEach -> + @schema.add 'validator-with-a-dash', (value) -> + value == 'valid' + + @schema.add 'template', + test: 'validator-with-a-dash' + + + it 'the validator is recognized', -> + isValid = @schema.validate 'template', + test: 'valid' + + expect(isValid).to.equal(true) + + describe 'a schema with a nested type', -> beforeEach ->