Skip to content

Commit 1144f6f

Browse files
codingbullBrian Vaughn
authored andcommitted
Override all overflow styles in fixed grid quadrants
1 parent 5304940 commit 1144f6f

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

source/MultiGrid/MultiGrid.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ export default class MultiGrid extends Component {
340340
left: 0,
341341
outline: 0,
342342
overflow: 'hidden',
343+
overflowX: 'hidden',
344+
overflowY: 'hidden',
343345
position: 'absolute',
344346
...styleBottomLeftGrid
345347
}
@@ -366,6 +368,8 @@ export default class MultiGrid extends Component {
366368
left: 0,
367369
outline: 0,
368370
overflow: 'hidden',
371+
overflowX: 'hidden',
372+
overflowY: 'hidden',
369373
position: 'absolute',
370374
top: 0,
371375
...styleTopLeftGrid
@@ -381,6 +385,8 @@ export default class MultiGrid extends Component {
381385
left: this._getLeftGridWidth(props),
382386
outline: 0,
383387
overflow: 'hidden',
388+
overflowX: 'hidden',
389+
overflowY: 'hidden',
384390
position: 'absolute',
385391
top: 0,
386392
...styleTopRightGrid

source/MultiGrid/MultiGrid.test.js

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,56 @@ describe('MultiGrid', () => {
4444
fixedColumnCount: 1,
4545
fixedRowCount: 1
4646
})))
47-
expect(rendered.querySelectorAll('.ReactVirtualized__Grid').length).toEqual(4)
47+
const grids = rendered.querySelectorAll('.ReactVirtualized__Grid')
48+
expect(grids.length).toEqual(4)
49+
const [topLeft, topRight, bottomLeft, bottomRight] = grids
50+
expect(topLeft.style.getPropertyValue('overflow')).toEqual('hidden')
51+
expect(topLeft.style.getPropertyValue('overflow-x')).toEqual('hidden')
52+
expect(topLeft.style.getPropertyValue('overflow-y')).toEqual('hidden')
53+
expect(topRight.style.getPropertyValue('overflow')).toEqual('hidden')
54+
expect(topRight.style.getPropertyValue('overflow-x')).toEqual('hidden')
55+
expect(topRight.style.getPropertyValue('overflow-y')).toEqual('hidden')
56+
expect(bottomLeft.style.getPropertyValue('overflow')).toEqual('hidden')
57+
expect(bottomLeft.style.getPropertyValue('overflow-x')).toEqual('hidden')
58+
expect(bottomLeft.style.getPropertyValue('overflow-y')).toEqual('hidden')
59+
expect(bottomRight.style.getPropertyValue('overflow')).toEqual('auto')
60+
expect(bottomRight.style.getPropertyValue('overflow-x')).toEqual('auto')
61+
expect(bottomRight.style.getPropertyValue('overflow-y')).toEqual('auto')
4862
})
4963

5064
it('should render 2 Grids when configured for fixed columns only', () => {
5165
const rendered = findDOMNode(render(getMarkup({
5266
fixedColumnCount: 1,
5367
fixedRowCount: 0
5468
})))
55-
expect(rendered.querySelectorAll('.ReactVirtualized__Grid').length).toEqual(2)
69+
const grids = rendered.querySelectorAll('.ReactVirtualized__Grid')
70+
expect(grids.length).toEqual(2)
71+
const [bottomLeft, bottomRight] = grids
72+
expect(bottomLeft.style.getPropertyValue('overflow')).toEqual('hidden')
73+
expect(bottomRight.style.getPropertyValue('overflow')).toEqual('auto')
5674
})
5775

5876
it('should render 2 Grids when configured for fixed rows only', () => {
5977
const rendered = findDOMNode(render(getMarkup({
6078
fixedColumnCount: 0,
6179
fixedRowCount: 1
6280
})))
63-
expect(rendered.querySelectorAll('.ReactVirtualized__Grid').length).toEqual(2)
81+
const grids = rendered.querySelectorAll('.ReactVirtualized__Grid')
82+
expect(grids.length).toEqual(2)
83+
const [topRight, bottomRight] = grids
84+
expect(topRight.style.getPropertyValue('overflow')).toEqual('hidden')
85+
expect(bottomRight.style.getPropertyValue('overflow')).toEqual('auto')
6486
})
6587

6688
it('should render 1 Grid when configured for neither fixed columns and rows', () => {
6789
const rendered = findDOMNode(render(getMarkup({
6890
fixedColumnCount: 0,
6991
fixedRowCount: 0
7092
})))
71-
expect(rendered.querySelectorAll('.ReactVirtualized__Grid').length).toEqual(1)
93+
const grids = rendered.querySelectorAll('.ReactVirtualized__Grid')
94+
expect(grids.length).toEqual(1)
95+
const [bottomRight] = grids
96+
expect(bottomRight.style.getPropertyValue('overflow')).toEqual('auto')
7297
})
7398

7499
it('should adjust the number of Grids when fixed column or row counts change', () => {

0 commit comments

Comments
 (0)