Web: Components: added new tests to help-button and tabs-container

This commit is contained in:
Nikita Gopienko 2019-12-18 12:09:03 +03:00
parent 387d275ec4
commit fb25736b1e
2 changed files with 33 additions and 57 deletions

View File

@ -59,4 +59,14 @@ describe("<HelpButton />", () => {
expect(wrapper.getDOMNode().style).toHaveProperty('color', 'red');
});
it("", () => {
const wrapper = mount(<HelpButton tooltipContent={tooltipContent} />).instance();
wrapper.componentDidUpdate(wrapper.props);
wrapper.componentDidUpdate({displayType: "auto"});
wrapper.componentDidUpdate({displayType: "aside"});
expect(wrapper.props).toBe(wrapper.props);
});
});

View File

@ -8,19 +8,10 @@ const array_items = [
title: "Title1",
content: (
<div>
<div>
<button>BUTTON</button> <button>BUTTON</button>
<button>BUTTON</button>
</div>
<div>
<button>BUTTON</button> <button>BUTTON</button>
<button>BUTTON</button>
</div>
<div>
<button>BUTTON</button> <button>BUTTON</button>
<button>BUTTON</button>
</div>
</div>
)
},
{
@ -28,15 +19,9 @@ const array_items = [
title: "Title2",
content: (
<div>
<div>
<label>LABEL</label> <label>LABEL</label> <label>LABEL</label>
</div>
<div>
<label>LABEL</label> <label>LABEL</label> <label>LABEL</label>
</div>
<div>
<label>LABEL</label> <label>LABEL</label> <label>LABEL</label>
</div>
<label>LABEL</label>
<label>LABEL</label>
<label>LABEL</label>
</div>
)
},
@ -45,15 +30,9 @@ const array_items = [
title: "Title3",
content: (
<div>
<div>
<input></input> <input></input> <input></input>
</div>
<div>
<input></input> <input></input> <input></input>
</div>
<div>
<input></input> <input></input> <input></input>
</div>
<input></input>
<input></input>
<input></input>
</div>
)
},
@ -62,21 +41,9 @@ const array_items = [
title: "Title4",
content: (
<div>
<div>
{" "}
<button>BUTTON</button> <button>BUTTON</button>{" "}
<button>BUTTON</button>{" "}
</div>
<div>
{" "}
<button>BUTTON</button> <button>BUTTON</button>{" "}
<button>BUTTON</button>{" "}
</div>
<div>
{" "}
<button>BUTTON</button> <button>BUTTON</button>{" "}
<button>BUTTON</button>{" "}
</div>
<button>BUTTON</button>
<button>BUTTON</button>
<button>BUTTON</button>
</div>
)
},
@ -85,18 +52,9 @@ const array_items = [
title: "Title5",
content: (
<div>
<div>
{" "}
<label>LABEL</label> <label>LABEL</label> <label>LABEL</label>{" "}
</div>
<div>
{" "}
<label>LABEL</label> <label>LABEL</label> <label>LABEL</label>{" "}
</div>
<div>
{" "}
<label>LABEL</label> <label>LABEL</label> <label>LABEL</label>{" "}
</div>
<label>LABEL</label>
<label>LABEL</label>
<label>LABEL</label>
</div>
)
}
@ -140,4 +98,12 @@ describe("<TabContainer />", () => {
);
expect(shouldUpdate).toBe(false);
});
it("TabsContainer not re-render test", () => {
const wrapper = mount(
<TabContainer>{array_items}</TabContainer>
).instance();
const shouldUpdate = wrapper.shouldComponentUpdate(wrapper.props, {...wrapper.state, activeTab: 3});
expect(shouldUpdate).toBe(true);
});
});