react-moment-proptypes
Advanced tools
Comparing version 1.1.1 to 1.1.2
12
index.js
@@ -22,7 +22,9 @@ var moment = require('moment'); | ||
propFullName = propFullName || propName; | ||
return new Error( | ||
'Required ' + locationName + ' `' + propFullName + | ||
'` was not specified in `' + | ||
componentName + '`.' | ||
); | ||
if (!props.hasOwnProperty(propName)) { | ||
return new Error( | ||
'Required ' + locationName + ' `' + propFullName + | ||
'` was not specified in `' + | ||
componentName + '`.' | ||
); | ||
} | ||
} | ||
@@ -29,0 +31,0 @@ |
{ | ||
"name": "react-moment-proptypes", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "React proptype for moment module", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -30,1 +30,8 @@ # react-moment-proptypes | ||
``` | ||
# Tests | ||
Tests were approached with `jsdom` and React's test utility renderer | ||
- `npm test` for running unit tests | ||
- `npm run coverage` for current test coverage |
@@ -10,2 +10,6 @@ import React from 'react'; | ||
function constructWarningsMessage(warnings) { | ||
return 'warnings: ' + JSON.stringify(warnings); | ||
} | ||
describe('ProptypeTests', () => { | ||
@@ -269,2 +273,31 @@ | ||
describe('Correct Required Input', () => { | ||
before(() => { | ||
TestClass = React.createClass({ | ||
propTypes : { | ||
testValidString : MomentPropTypes.momentString.isRequired, | ||
testValidObject : MomentPropTypes.momentObj.isRequired, | ||
}, | ||
render() { | ||
return null; | ||
}, | ||
}); | ||
}); | ||
it('should have no warnings for the optional moment string', (done) => { | ||
const testElement = <TestClass testValidString={'12-12-2015'} testValidObject={moment()} />; | ||
TestUtils.renderIntoDocument(testElement); | ||
expect(warnings).to.be.an('array', constructWarningsMessage(warnings)); | ||
expect(warnings.length).to.equal(0, constructWarningsMessage(warnings)); | ||
done(); | ||
}); | ||
}); | ||
}); |
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
17276
271
37