Include static properties in jest mocks for core components
Summary: This is necessary to provide things like `Image.prefetch` in Jest tests. Previously this only gave access to propTypes. Reviewed By: sahrens Differential Revision: D8526494 fbshipit-source-id: 11d49d95d6edf3f75c90438e0b629f5345bc980d
This commit is contained in:
parent
e7256a777e
commit
66aeeff2f9
|
@ -48,9 +48,9 @@ module.exports = (moduleName, instanceMethods) => {
|
|||
}
|
||||
};
|
||||
|
||||
if (RealComponent.propTypes != null) {
|
||||
Component.propTypes = RealComponent.propTypes;
|
||||
}
|
||||
Object.keys(RealComponent).forEach(classStatic => {
|
||||
Component[classStatic] = RealComponent[classStatic];
|
||||
});
|
||||
|
||||
if (instanceMethods != null) {
|
||||
Object.assign(Component.prototype, instanceMethods);
|
||||
|
|
Loading…
Reference in New Issue