Skip to content

Commit

Permalink
Merge 6f4e347 into f921fdb
Browse files Browse the repository at this point in the history
  • Loading branch information
trongtai37 authored Mar 20, 2023
2 parents f921fdb + 6f4e347 commit 87a476c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ function Table<RecordType extends DefaultRecordType>(tableProps: TableProps<Reco

if (fixHeader) {
scrollYStyle = {
overflowY: 'scroll',
overflowY: 'auto',
maxHeight: scroll.y,
};
}
Expand Down
11 changes: 7 additions & 4 deletions tests/Scroll.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import React from 'react';
import { mount } from 'enzyme';
import { act } from 'react-dom/test-utils';
import { spyElementPrototypes } from 'rc-util/lib/test/domHook';
import React from 'react';
import { act } from 'react-dom/test-utils';
import Table from '../src';

describe('Table.Scroll', () => {
const data = [{ key: 'key0', name: 'Lucy' }, { key: 'key1', name: 'Jack' }];
const data = [
{ key: 'key0', name: 'Lucy' },
{ key: 'key1', name: 'Jack' },
];
const createTable = props => {
const columns = [{ title: 'Name', dataIndex: 'name', key: 'name' }];

Expand All @@ -32,7 +35,7 @@ describe('Table.Scroll', () => {
it('renders scroll.x and scroll.y are both true', () => {
const wrapper = mount(createTable({ scroll: { x: true, y: 200 } }));
expect(wrapper.find('.rc-table-body').props().style.overflowX).toEqual('auto');
expect(wrapper.find('.rc-table-body').props().style.overflowY).toEqual('scroll');
expect(wrapper.find('.rc-table-body').props().style.overflowY).toEqual('auto');
});

it('fire scroll event', () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/__snapshots__/FixedColumn.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@ exports[`Table.FixedColumn renders correctly scrollXY - with data 1`] = `
</div>
<div
class="rc-table-body"
style="overflow-x: auto; overflow-y: scroll; max-height: 100px;"
style="overflow-x: auto; overflow-y: auto; max-height: 100px;"
>
<table
style="width: 1200px; min-width: 100%; table-layout: fixed;"
Expand Down Expand Up @@ -2800,7 +2800,7 @@ exports[`Table.FixedColumn renders correctly scrollXY - without data 1`] = `
</div>
<div
class="rc-table-body"
style="overflow-x: auto; overflow-y: scroll; max-height: 100px;"
style="overflow-x: auto; overflow-y: auto; max-height: 100px;"
>
<table
style="width: 1200px; min-width: 100%; table-layout: fixed;"
Expand Down
2 changes: 1 addition & 1 deletion tests/__snapshots__/Table.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ exports[`Table.Basic custom components renders fixed column and header correctly
</div>
<div
class="rc-table-body"
style="overflow-x: auto; overflow-y: scroll; max-height: 100px;"
style="overflow-x: auto; overflow-y: auto; max-height: 100px;"
>
<table
name="my-table"
Expand Down

0 comments on commit 87a476c

Please sign in to comment.