diff --git a/test/utils/CustomPropTypesSpec.js b/test/utils/CustomPropTypesSpec.js index ef6d8e152e..4254569ea8 100644 --- a/test/utils/CustomPropTypesSpec.js +++ b/test/utils/CustomPropTypesSpec.js @@ -167,4 +167,21 @@ describe('CustomPropTypes', function() { validators[2].should.not.have.been.called; }); }); + + describe('isRequiredForA11y', function () { + function validate(prop) { + return CustomPropTypes.isRequiredForA11y(React.PropTypes.string)({p: prop}, 'p', 'Component'); + } + + it('Should validate OK when property is provided', function() { + let err = validate('aria-tag'); + assert.notInstanceOf(err, Error); + }); + + it('Should return custom error message when property is not provided', function() { + let err = validate(null); + assert.instanceOf(err, Error); + assert.include(err.message, 'accessible for users using assistive technologies such as screen readers'); + }); + }); });