AAE-12844: Column Resizing Improvements (#8340)

* AAE-12844: Column Resizing Improvements

* AAE-12844: Added extra check on column header query selector

* AAE-12844: Fixed lint issue

* AAE-12844: Fixed unit tests

* AAE-122844: Code improvement

* AAE-12844: Added missing if condition
This commit is contained in:
Ehsan Rezaei
2023-03-10 22:26:15 +01:00
committed by GitHub
parent d1fa1a3cd7
commit ccbf76a75e
8 changed files with 96 additions and 90 deletions

View File

@@ -379,19 +379,11 @@ describe('ProcessListCloudComponent', () => {
component.reload();
fixture.detectChanges();
const resizeHandle: HTMLElement = fixture.debugElement.nativeElement.querySelector('.adf-datatable__resize-handle');
const newColumns = [...component.columns];
newColumns[0].width = 120;
component.onColumnsWidthChanged(newColumns);
resizeHandle.dispatchEvent(new MouseEvent('mousedown'));
resizeHandle.dispatchEvent(new MouseEvent('mousemove'));
resizeHandle.dispatchEvent(new MouseEvent('mouseup'));
const firstColumnInitialWidth = component.columns[0].width ?? 0;
resizeHandle.dispatchEvent(new MouseEvent('mousedown'));
resizeHandle.dispatchEvent(new MouseEvent('mousemove', { clientX: 25 }));
resizeHandle.dispatchEvent(new MouseEvent('mouseup'));
expect(component.columns[0].width).toBe(firstColumnInitialWidth + 25);
expect(component.columns[0].width).toBe(120);
});
it('should re-create columns when a column order gets changed', () => {

View File

@@ -287,25 +287,14 @@ describe('TaskListCloudComponent', () => {
});
it('should re-create columns when a column width gets changed', () => {
component.isResizingEnabled = true;
spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks));
component.reload();
fixture.detectChanges();
const resizeHandle: HTMLElement = fixture.debugElement.nativeElement.querySelector('.adf-datatable__resize-handle');
const newColumns = [...component.columns];
newColumns[0].width = 120;
component.onColumnsWidthChanged(newColumns);
resizeHandle.dispatchEvent(new MouseEvent('mousedown'));
resizeHandle.dispatchEvent(new MouseEvent('mousemove'));
resizeHandle.dispatchEvent(new MouseEvent('mouseup'));
const firstColumnInitialWidth = component.columns[0].width ?? 0;
resizeHandle.dispatchEvent(new MouseEvent('mousedown'));
resizeHandle.dispatchEvent(new MouseEvent('mousemove', { clientX: 25 }));
resizeHandle.dispatchEvent(new MouseEvent('mouseup'));
expect(component.columns[0].width).toBe(firstColumnInitialWidth + 25);
expect(component.columns[0].width).toBe(120);
});
it('should re-create columns when a column order gets changed', () => {