-
Notifications
You must be signed in to change notification settings - Fork 669
T1335911 - DataGrid — Incorrect column resize separator position when resizing a column fixed to the right if another column is behind it #35364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bit-byte0
wants to merge
4
commits into
DevExpress:main
Choose a base branch
from
bit-byte0:fix/t1335911-sticky-right-resize-separator
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+136
−4
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
af8b9fc
fix(dataGrid): correct resize separator position for right-fixed stic…
bit-byte0 9eab518
fix(dataGrid): resolve sticky resize separator next column by index
bit-byte0 92685a0
Merge branch 'main' into fix/t1335911-sticky-right-resize-separator
bit-byte0 7fea01d
fix(dataGrid): correct resize separator for directly-resized right-fi…
bit-byte0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
...nternal/grids/grid_core/sticky_columns/__tests__/m_sticky_columns.columns_resizer.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| import { | ||
| afterEach, describe, expect, it, jest, | ||
| } from '@jest/globals'; | ||
| import type { dxElementWrapper } from '@js/core/renderer'; | ||
|
|
||
| import { GridCoreStickyColumnsDom } from '../dom'; | ||
| import { stickyColumnsModule } from '../m_sticky_columns'; | ||
|
|
||
| const SUPER_OFFSET = 540; | ||
| const CELL_LEFT = 419; | ||
| const NEXT_CELL_LEFT = 399; | ||
| const NEXT_COLUMN_INDEX = 4; | ||
|
|
||
| const { columnsResizer } = stickyColumnsModule.extenders.controllers; | ||
|
|
||
| const $nextCell = { | ||
| length: 1, | ||
| offset: () => ({ left: NEXT_CELL_LEFT }), | ||
| } as unknown as dxElementWrapper; | ||
|
|
||
| const $cell = { | ||
| offset: () => ({ left: CELL_LEFT }), | ||
| } as unknown as dxElementWrapper; | ||
|
|
||
| const columnElements = { | ||
| eq: (index: number) => (index === NEXT_COLUMN_INDEX ? $nextCell : { length: 0 }), | ||
| }; | ||
|
|
||
| describe('sticky columns resizer separator offset', () => { | ||
| let superGetSeparatorOffsetX: ReturnType<typeof jest.fn>; | ||
|
|
||
| const createController = ({ | ||
| hasStickyColumns = true, | ||
| columnResizingMode = 'nextColumn', | ||
| }: { | ||
| hasStickyColumns?: boolean; | ||
| columnResizingMode?: string; | ||
| } = {}): any => { | ||
| superGetSeparatorOffsetX = jest.fn(() => SUPER_OFFSET); | ||
|
|
||
| class Base { | ||
| // eslint-disable-next-line class-methods-use-this | ||
| public getSeparatorOffsetX(...args: unknown[]): number { | ||
| return superGetSeparatorOffsetX(...args) as number; | ||
| } | ||
| } | ||
|
|
||
| const Controller = columnsResizer(Base as any); | ||
| const controller = new Controller() as any; | ||
|
|
||
| controller._columnHeadersView = { | ||
| hasStickyColumns: (): boolean => hasStickyColumns, | ||
| getContent: (): undefined => undefined, | ||
| getColumnElements: () => columnElements, | ||
| }; | ||
| controller._resizingInfo = { nextColumnIndex: NEXT_COLUMN_INDEX }; | ||
| controller.option = (): string => columnResizingMode; | ||
| controller.addWidgetPrefix = (name: string): string => name; | ||
|
|
||
| return controller; | ||
| }; | ||
|
|
||
| afterEach(() => { | ||
| jest.restoreAllMocks(); | ||
| }); | ||
|
|
||
| it('returns the next column left edge when the next column is pinned to the right in nextColumn mode (T1335911)', () => { | ||
| jest.spyOn(GridCoreStickyColumnsDom, 'isFixedCellPinnedToRight') | ||
| .mockImplementation((cell) => cell === $nextCell); | ||
|
|
||
| const controller = createController({ columnResizingMode: 'nextColumn' }); | ||
|
|
||
| expect(controller.getSeparatorOffsetX($cell)).toBe(NEXT_CELL_LEFT); | ||
| expect(superGetSeparatorOffsetX).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it('returns the cell left edge when the resized column itself is pinned to the right in nextColumn mode (T1335911)', () => { | ||
| jest.spyOn(GridCoreStickyColumnsDom, 'isFixedCellPinnedToRight') | ||
| .mockImplementation((cell) => cell === $cell); | ||
|
|
||
| const controller = createController({ columnResizingMode: 'nextColumn' }); | ||
|
|
||
| expect(controller.getSeparatorOffsetX($cell)).toBe(CELL_LEFT); | ||
| expect(superGetSeparatorOffsetX).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it('returns the cell left edge when the resized column itself is pinned to the right in widget mode (T1335911)', () => { | ||
| jest.spyOn(GridCoreStickyColumnsDom, 'isFixedCellPinnedToRight') | ||
| .mockImplementation((cell) => cell === $cell); | ||
|
|
||
| const controller = createController({ columnResizingMode: 'widget' }); | ||
|
|
||
| expect(controller.getSeparatorOffsetX($cell)).toBe(CELL_LEFT); | ||
| expect(superGetSeparatorOffsetX).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it('falls back to the base offset when only the next column is pinned to the right in widget mode (T1335911)', () => { | ||
| jest.spyOn(GridCoreStickyColumnsDom, 'isFixedCellPinnedToRight') | ||
| .mockImplementation((cell) => cell === $nextCell); | ||
|
|
||
| const controller = createController({ columnResizingMode: 'widget' }); | ||
|
|
||
| expect(controller.getSeparatorOffsetX($cell)).toBe(SUPER_OFFSET); | ||
| expect(superGetSeparatorOffsetX).toHaveBeenCalledWith($cell); | ||
| }); | ||
|
|
||
| it('falls back to the base offset when neither the cell nor its next column is pinned to the right (T1335911)', () => { | ||
| jest.spyOn(GridCoreStickyColumnsDom, 'isFixedCellPinnedToRight').mockReturnValue(false); | ||
|
|
||
| const controller = createController({ columnResizingMode: 'nextColumn' }); | ||
|
|
||
| expect(controller.getSeparatorOffsetX($cell)).toBe(SUPER_OFFSET); | ||
| expect(superGetSeparatorOffsetX).toHaveBeenCalledWith($cell); | ||
| }); | ||
|
|
||
| it('falls back to the base offset when there are no sticky columns (T1335911)', () => { | ||
| const spy = jest.spyOn(GridCoreStickyColumnsDom, 'isFixedCellPinnedToRight'); | ||
|
|
||
| const controller = createController({ hasStickyColumns: false }); | ||
|
|
||
| expect(controller.getSeparatorOffsetX($cell)).toBe(SUPER_OFFSET); | ||
| expect(spy).not.toHaveBeenCalled(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RTL mode is not taken into account. Also, just in case, please check the resizing behavior with the following functionality:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked RTL, widget mode, band columns and adaptivity in the browser - the separator tracks the column edge in each, so RTL needs no special handling here