Skip to content

Commit

Permalink
✅ fix test case
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Dec 26, 2019
1 parent 992e082 commit 1be9450
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/Table.fixedColumns.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe('Table.fixedColumns', () => {

it('calculate fixedColumns row height', () => {
const wrapper = mount(<Table columns={columns} data={data} scroll={{ x: 1200 }} />);
const tableNode = wrapper.instance().tableNode;
const { tableNode } = wrapper.instance();
const rows = tableNode.querySelectorAll('tr');
const theads = tableNode.querySelectorAll('thead');
const fixedLeftRows = tableNode.querySelectorAll('.rc-table-fixed-left tr');
Expand Down Expand Up @@ -162,29 +162,29 @@ describe('Table.fixedColumns', () => {
// <Table /> is show.
simulateTableShow();
wrapper.setProps({});
fixedLeftRows.forEach(tr => {
expect(tr.style.height).toBe(rowHeight);
fixedLeftRows.forEach((tr, i) => {
expect(tr.style.height).toBe(i === 0 ? '29.5px' : rowHeight);
});
fixedRightRows.forEach(tr => {
expect(tr.style.height).toBe(rowHeight);
fixedRightRows.forEach((tr, i) => {
expect(tr.style.height).toBe(i === 0 ? '29.5px' : rowHeight);
});

// <Table /> is hidden.
simulateTableHidden();
wrapper.update();
fixedLeftRows.forEach(tr => {
expect(tr.style.height).toBe(rowHeight);
fixedLeftRows.forEach((tr, i) => {
expect(tr.style.height).toBe(i === 0 ? '29.5px' : rowHeight);
});
fixedRightRows.forEach(tr => {
expect(tr.style.height).toBe(rowHeight);
fixedRightRows.forEach((tr, i) => {
expect(tr.style.height).toBe(i === 0 ? '29.5px' : rowHeight);
});
});

it('has correct scroll classNames when table resize', () => {
const wrapper = mount(
<Table columns={columns} data={data} scroll={{ x: true }} style={{ width: 2000 }} />,
);
const tableNode = wrapper.instance().tableNode;
const { tableNode } = wrapper.instance();
const tableBodyContainer = tableNode.querySelectorAll('.rc-table-scroll > .rc-table-body')[0];
const tableBodyNode = tableBodyContainer.children[0];
expect(tableNode.className).toContain('rc-table-scroll-position-left');
Expand Down

0 comments on commit 1be9450

Please sign in to comment.