Skip to content

Commit 5df7f5b

Browse files
committed
-Added test case for hoisting statics in withLoclize HOC
1 parent 622476f commit 5df7f5b

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

tests/withLocalize.test.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const getWithLocalizeWithContext = () => {
2323
}
2424
}
2525
});
26-
26+
2727
return require('withLocalize').withLocalize;
2828
};
2929

@@ -50,4 +50,20 @@ describe('withLocalize', () => {
5050
const wrapper = result.dive();
5151
expect(wrapper.props().name).toEqual('Testy McTest');
5252
});
53-
});
53+
54+
it('should hoist any existing static functions on WrappedComponent', () => {
55+
const withLocalize = getWithLocalizeWithContext();
56+
class WrapperComponent extends React.Component {
57+
static sayHello() {
58+
return 'hello';
59+
}
60+
render() {
61+
return (
62+
<h1>Hello You!</h1>
63+
);
64+
}
65+
};
66+
const Wrapped = withLocalize(WrapperComponent);
67+
expect(Wrapped.sayHello()).toEqual('hello')
68+
});
69+
});

0 commit comments

Comments
 (0)