Translate Spaces component (#24411)

* Translate Spaces component

* fix one little error

* update Spaces component

* update translation of Spaces components

* Update snapshots

* update Space translation - intl type

* update Space translation - remove view/views id namespace

* rename ids

* use testing helper functions instead of shallow, render, mount from enzyme

* fix unit tests

* fix ts path for enzyme test helpers

* fix path to enzyme helpers test functions

* Update snapshots

* fix path to enzyme test helpers

* Remove unused dependency.
This commit is contained in:
tibmt 2018-11-15 11:09:12 +03:00 committed by Maryia Lapata
parent 1155b81b4f
commit fb6be4caed
46 changed files with 797 additions and 219 deletions

View file

@ -5,8 +5,8 @@
*/
import { EuiFlyout, EuiLink } from '@elastic/eui';
import { mount, shallow } from 'enzyme';
import React from 'react';
import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers';
import { ImpactedSpacesFlyout } from './impacted_spaces_flyout';
import { PrivilegeSpaceTable } from './privilege_space_table';
@ -52,16 +52,16 @@ const buildProps = (customProps = {}) => {
describe('<ImpactedSpacesFlyout>', () => {
it('renders without crashing', () => {
expect(shallow(<ImpactedSpacesFlyout {...buildProps()} />)).toMatchSnapshot();
expect(shallowWithIntl(<ImpactedSpacesFlyout {...buildProps()} />)).toMatchSnapshot();
});
it('does not immediately show the flyout', () => {
const wrapper = mount(<ImpactedSpacesFlyout {...buildProps()} />);
const wrapper = mountWithIntl(<ImpactedSpacesFlyout {...buildProps()} />);
expect(wrapper.find(EuiFlyout)).toHaveLength(0);
});
it('shows the flyout after clicking the link', () => {
const wrapper = mount(<ImpactedSpacesFlyout {...buildProps()} />);
const wrapper = mountWithIntl(<ImpactedSpacesFlyout {...buildProps()} />);
wrapper.find(EuiLink).simulate('click');
expect(wrapper.find(EuiFlyout)).toHaveLength(1);
});
@ -82,7 +82,7 @@ describe('<ImpactedSpacesFlyout>', () => {
},
});
const wrapper = shallow(<ImpactedSpacesFlyout {...props} />);
const wrapper = shallowWithIntl(<ImpactedSpacesFlyout {...props} />);
wrapper.find(EuiLink).simulate('click');
const table = wrapper.find(PrivilegeSpaceTable);
@ -112,7 +112,7 @@ describe('<ImpactedSpacesFlyout>', () => {
},
});
const wrapper = shallow(<ImpactedSpacesFlyout {...props} />);
const wrapper = shallowWithIntl(<ImpactedSpacesFlyout {...props} />);
wrapper.find(EuiLink).simulate('click');
const table = wrapper.find(PrivilegeSpaceTable);
@ -141,7 +141,7 @@ describe('<ImpactedSpacesFlyout>', () => {
},
});
const wrapper = shallow(<ImpactedSpacesFlyout {...props} />);
const wrapper = shallowWithIntl(<ImpactedSpacesFlyout {...props} />);
wrapper.find(EuiLink).simulate('click');
const table = wrapper.find(PrivilegeSpaceTable);