@dhis2/prop-types
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -80,2 +80,15 @@ "use strict"; | ||
}); | ||
it('does not produce a warning when the deprecated prop is not passed', () => { | ||
const propType = { | ||
deprecatedBool: (0, _deprecated.deprecated)(_propTypes.default.bool, 'Please do not use anymore') | ||
}; | ||
const props = { | ||
deprecatedBool: undefined | ||
}; | ||
_propTypes.default.checkPropTypes(propType, props, 'deprecatedMandatoryBool', 'TestComponent'); | ||
expect(console.error).toBeCalledTimes(0); | ||
expect(console.warn).toBeCalledTimes(0); | ||
}); | ||
}); |
@@ -17,3 +17,3 @@ "use strict"; | ||
if (!emmittedWarnings.has(message)) { | ||
if (typeof props[propName] !== 'undefined' && !emmittedWarnings.has(message)) { | ||
console.warn(message); | ||
@@ -20,0 +20,0 @@ emmittedWarnings.add(message); |
@@ -65,2 +65,13 @@ import propTypes from 'prop-types'; | ||
}); | ||
it('does not produce a warning when the deprecated prop is not passed', () => { | ||
const propType = { | ||
deprecatedBool: deprecated(propTypes.bool, 'Please do not use anymore') | ||
}; | ||
const props = { | ||
deprecatedBool: undefined | ||
}; | ||
propTypes.checkPropTypes(propType, props, 'deprecatedMandatoryBool', 'TestComponent'); | ||
expect(console.error).toBeCalledTimes(0); | ||
expect(console.warn).toBeCalledTimes(0); | ||
}); | ||
}); |
@@ -7,3 +7,3 @@ import propTypes from 'prop-types'; | ||
if (!emmittedWarnings.has(message)) { | ||
if (typeof props[propName] !== 'undefined' && !emmittedWarnings.has(message)) { | ||
console.warn(message); | ||
@@ -10,0 +10,0 @@ emmittedWarnings.add(message); |
@@ -0,1 +1,8 @@ | ||
## [3.1.2](https://github.com/dhis2/prop-types/compare/v3.1.1...v3.1.2) (2022-05-24) | ||
### Bug Fixes | ||
* **deprecated:** show warning only if prop is populated ([#289](https://github.com/dhis2/prop-types/issues/289)) ([1417bda](https://github.com/dhis2/prop-types/commit/1417bdafb43e586e4c7422c1f3ca26fc9928e88f)) | ||
## [3.1.1](https://github.com/dhis2/prop-types/compare/v3.1.0...v3.1.1) (2022-05-24) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@dhis2/prop-types", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"main": "./build/cjs/index.js", | ||
@@ -5,0 +5,0 @@ "module": "./build/es/index.js", |
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
129656
2721