diff --git a/web/ASC.Web.Components/src/components/drop-down-item/drop-down-item.test.js b/web/ASC.Web.Components/src/components/drop-down-item/drop-down-item.test.js
index a7734a6666..1b958e6ac9 100644
--- a/web/ASC.Web.Components/src/components/drop-down-item/drop-down-item.test.js
+++ b/web/ASC.Web.Components/src/components/drop-down-item/drop-down-item.test.js
@@ -1,18 +1,76 @@
import React from 'react';
-import { mount } from 'enzyme';
+import { mount, shallow } from 'enzyme';
import DropDownItem from '.';
+const baseProps = {
+ isSeparator: false,
+ isHeader: false,
+ tabIndex: -1,
+ label: 'test',
+ disabled: false,
+ icon: 'NavLogoIcon',
+ noHover: false,
+ onClick: jest.fn()
+}
+
describe('', () => {
it('renders without error', () => {
const wrapper = mount(
- console.log('Button 1 clicked')} />
+
);
expect(wrapper).toExist();
});
+
+ it('check disabled props', () => {
+ const wrapper = mount(
+
+ );
+
+ expect(wrapper.prop('disabled')).toEqual(true);
+ });
+
+ it('check isSeparator props', () => {
+ const wrapper = mount(
+
+ );
+
+ expect(wrapper.prop('isSeparator')).toEqual(true);
+ });
+
+ it('check isHeader props', () => {
+ const wrapper = mount(
+
+ );
+
+ expect(wrapper.prop('isHeader')).toEqual(true);
+ });
+
+ it('check noHover props', () => {
+ const wrapper = mount(
+
+ );
+
+ expect(wrapper.prop('noHover')).toEqual(true);
+ });
+
+ it('causes function onClick()', () => {
+ const onClick = jest.fn();
+
+ const wrapper = shallow();
+
+ wrapper.find("#test").simulate("click")
+
+ expect(onClick).toHaveBeenCalled();
+ });
+
+ it('render without child', () => {
+ const wrapper = shallow(
+
+ test
+
+ );
+
+ expect(wrapper.props.children).toEqual(undefined);
+ });
});
diff --git a/web/ASC.Web.Components/src/components/drop-down/drop-down.test.js b/web/ASC.Web.Components/src/components/drop-down/drop-down.test.js
index d1d4e71b3f..1c94009408 100644
--- a/web/ASC.Web.Components/src/components/drop-down/drop-down.test.js
+++ b/web/ASC.Web.Components/src/components/drop-down/drop-down.test.js
@@ -35,12 +35,24 @@ describe('', () => {
expect(wrapper.prop('directionX')).toEqual('right');
});
+ it('directionX right manualX', () => {
+ const wrapper = mount();
+
+ expect(wrapper.prop('directionX')).toEqual('right');
+ });
+
it('directionY top', () => {
const wrapper = mount();
expect(wrapper.prop('directionY')).toEqual('top');
});
+ it('directionY top manualY', () => {
+ const wrapper = mount();
+
+ expect(wrapper.prop('directionY')).toEqual('top');
+ });
+
it('withArrow', () => {
const wrapper = mount();
@@ -74,15 +86,37 @@ describe('', () => {
expect(wrapper.children()).toHaveLength(1);
});
- /*
- it('with maxHeight and children', () => {
- const wrapper = mount((
-
- 1
-
- ));
- expect(wrapper.children()).toHaveLength(1);
+ it('with maxHeight and children', () => {
+ const child = (1
);
+ const wrapper = shallow((
+
+ {child}
+
+ )).instance();
+
+ expect(wrapper.props.children).toEqual(child);
});
- */
+
+ it('componentDidUpdate() state lifecycle test', () => {
+ const wrapper = shallow();
+ const instance = wrapper.instance();
+
+ wrapper.setState({ isOpen: true });
+
+ instance.componentDidUpdate(wrapper.props(), wrapper.state());
+
+ expect(wrapper.state()).toBe(wrapper.state());
+ });
+
+ it('componentDidUpdate() props lifecycle test', () => {
+ const wrapper = shallow();
+ const instance = wrapper.instance();
+
+ instance.componentDidUpdate({ opened: true }, wrapper.state());
+
+ expect(wrapper.props()).toBe(wrapper.props());
+ });
+
});