Skip to content

Commit

Permalink
fix(AnalyticalTable): respect columnOrder prop (#666)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas742 authored Aug 24, 2020
1 parent 972ee49 commit 05382b8
Show file tree
Hide file tree
Showing 3 changed files with 408 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createPassThroughPropsTest } from '@shared/tests/utils';
import { act, render, screen, fireEvent, cleanStaticAreaAfterEachTest, waitFor } from '@shared/tests';
import { act, render, screen, fireEvent, cleanStaticAreaAfterEachTest, waitFor, getByText } from '@shared/tests';
import { AnalyticalTable } from '@ui5/webcomponents-react/lib/AnalyticalTable';
import { TableSelectionBehavior } from '@ui5/webcomponents-react/lib/TableSelectionBehavior';
import { TableSelectionMode } from '@ui5/webcomponents-react/lib/TableSelectionMode';
Expand Down Expand Up @@ -217,6 +217,25 @@ describe('AnalyticalTable', () => {
expect(wrapper.render()).toMatchSnapshot();
});

test('with initial column order', () => {
const { getAllByRole, asFragment } = render(
<AnalyticalTable
data={data}
columns={columns}
groupable={false}
filterable={false}
sortable={false}
columnOrder={['age', 'friend.age', 'friend.name', 'name']}
/>
);
const columnHeaders = getAllByRole('columnheader', { hidden: true });

['Age', 'Friend Age', 'Friend Name', 'Name'].forEach((item, index) => {
getByText(columnHeaders[index], item);
});
expect(asFragment()).toMatchSnapshot();
});

test('test drag and drop of a draggable column', () => {
const wrapper = mount(<AnalyticalTable data={data} title={'Test'} columns={columns} />);

Expand Down
Loading

0 comments on commit 05382b8

Please sign in to comment.