Skip to content

Commit 0991231

Browse files
xPhentomWouter Roozeleer
andauthored
Fix shadows still shown after resize to fullscreen (#825)
Co-authored-by: Wouter Roozeleer <[email protected]>
1 parent 9e87b99 commit 0991231

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

src/Table.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,8 @@ function Table<RecordType extends DefaultRecordType>(props: TableProps<RecordTyp
489489
const { scrollWidth, clientWidth } = currentTarget;
490490
// There is no space to scroll
491491
if (scrollWidth === clientWidth) {
492+
setPingedLeft(false);
493+
setPingedRight(false);
492494
return;
493495
}
494496
if (isRTL) {

tests/FixedColumn.spec.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import React from 'react';
21
import { mount } from 'enzyme';
3-
import { act } from 'react-dom/test-utils';
4-
import { resetWarned } from 'rc-util/lib/warning';
2+
import RcResizeObserver from 'rc-resize-observer';
53
import { spyElementPrototype } from 'rc-util/lib/test/domHook';
4+
import { resetWarned } from 'rc-util/lib/warning';
5+
import { act } from 'react-dom/test-utils';
66
import Table from '../src';
7-
import RcResizeObserver from 'rc-resize-observer';
87

98
describe('Table.FixedColumn', () => {
109
let domSpy;
@@ -160,6 +159,23 @@ describe('Table.FixedColumn', () => {
160159
wrapper.update();
161160
expect(wrapper.find('.rc-table').hasClass('rc-table-ping-left')).toBeTruthy();
162161
expect(wrapper.find('.rc-table').hasClass('rc-table-ping-right')).toBeFalsy();
162+
163+
// Fullscreen
164+
act(() => {
165+
wrapper
166+
.find('.rc-table-content')
167+
.props()
168+
.onScroll({
169+
currentTarget: {
170+
scrollLeft: 0,
171+
scrollWidth: 100,
172+
clientWidth: 100,
173+
},
174+
});
175+
});
176+
wrapper.update();
177+
expect(wrapper.find('.rc-table').hasClass('rc-table-ping-left')).toBeFalsy();
178+
expect(wrapper.find('.rc-table').hasClass('rc-table-ping-right')).toBeFalsy();
163179
});
164180

165181
describe('warning if fixed not continue', () => {

0 commit comments

Comments
 (0)