only load non assigned tags

fix custom onClick events
This commit is contained in:
lukas committed 2020-09-26 18:43:30 +00:00
1 parent b36327b332
commit 8f88aa3c02
5 files changed
+191 -49

No files matched your search

+5
View File
@@ -18,6 +18,11 @@ class Tag extends React.Component {
* click handling for a Tag
*/
TagClick() {
if (this.props.onclick) {
this.props.onclick();
return;
}
const tag = this.props.children.toString().toLowerCase();
// call callback functin to switch to category page with specified tag
+13
View File
@@ -31,4 +31,17 @@ describe('<Tag/>', function () {
expect(func).toBeCalledTimes(1);
});
it('test custom onclick function', function () {
const func = jest.fn();
const wrapper = shallow(<Tag
onclick={() => {func()}}>test</Tag>);
expect(func).toBeCalledTimes(0);
wrapper.simulate("click");
expect(func).toBeCalledTimes(1);
});
});