Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/cdk-experimental/column-resize/event-dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import {Injectable, NgZone, inject} from '@angular/core';
import {combineLatest, MonoTypeOperatorFunction, Observable, Subject} from 'rxjs';
import {distinctUntilChanged, map, share, skip, startWith} from 'rxjs/operators';
import {distinctUntilChanged, map, share, skip, startWith, debounceTime} from 'rxjs/operators';

import {_closest} from '../popover-edit';

Expand All @@ -33,7 +33,11 @@ export class HeaderRowEventDispatcher {
readonly overlayHandleActiveForCell = new Subject<Element | null>();

/** Distinct and shared version of headerCellHovered. */
readonly headerCellHoveredDistinct = this.headerCellHovered.pipe(distinctUntilChanged(), share());
readonly headerCellHoveredDistinct = this.headerCellHovered.pipe(
distinctUntilChanged(),
debounceTime(200),
share(),
);

/**
* Emits the header that is currently hovered or hosting an active resize event (with active
Expand Down
12 changes: 11 additions & 1 deletion src/material-experimental/column-resize/column-resize.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Injectable,
ViewChild,
} from '@angular/core';
import {ComponentFixture, TestBed, fakeAsync, flush} from '@angular/core/testing';
import {ComponentFixture, TestBed, fakeAsync, flush, tick} from '@angular/core/testing';
import {MatTableModule} from '@angular/material/table';
import {BehaviorSubject, Observable, ReplaySubject} from 'rxjs';
import {dispatchKeyboardEvent} from '../../cdk/testing/private';
Expand Down Expand Up @@ -401,6 +401,7 @@ describe('Material Popover Edit', () => {

component.triggerHoverState();
fixture.detectChanges();
tick(200);

expect(
component.getOverlayThumbElement(0).classList.contains('mat-column-resize-overlay-thumb'),
Expand Down Expand Up @@ -438,6 +439,7 @@ describe('Material Popover Edit', () => {
component.completeResizeWithMouseInProgress(0);
component.endHoverState();
fixture.detectChanges();
tick(200);
flush();

expect(component.getOverlayThumbElement(0)).toBeUndefined();
Expand All @@ -451,6 +453,7 @@ describe('Material Popover Edit', () => {

component.triggerHoverState();
fixture.detectChanges();
tick(200);
component.beginColumnResizeWithMouse(1);

const initialThumbPosition = component.getOverlayThumbPosition(1);
Expand Down Expand Up @@ -500,6 +503,7 @@ describe('Material Popover Edit', () => {

component.triggerHoverState();
fixture.detectChanges();
tick(200);
component.beginColumnResizeWithMouse(1);

const initialThumbPosition = component.getOverlayThumbPosition(1);
Expand Down Expand Up @@ -535,6 +539,7 @@ describe('Material Popover Edit', () => {

component.triggerHoverState();
fixture.detectChanges();
tick(200);
component.beginColumnResizeWithMouse(1, 2);

const initialPosition = component.getOverlayThumbPosition(1);
Expand All @@ -552,6 +557,7 @@ describe('Material Popover Edit', () => {

component.triggerHoverState();
fixture.detectChanges();
tick(200);
component.beginColumnResizeWithMouse(1);

const initialThumbPosition = component.getOverlayThumbPosition(1);
Expand Down Expand Up @@ -589,6 +595,7 @@ describe('Material Popover Edit', () => {

component.triggerHoverState();
fixture.detectChanges();
tick(200);

expect(resize).toBe(null);

Expand All @@ -610,6 +617,7 @@ describe('Material Popover Edit', () => {

component.triggerHoverState();
fixture.detectChanges();
tick(200);
component.beginColumnResizeWithMouse(0);

component.updateResizeWithMouseInProgress(5);
Expand Down Expand Up @@ -674,6 +682,7 @@ describe('Material Popover Edit', () => {

component.triggerHoverState();
fixture.detectChanges();
tick(200);

component.resizeColumnWithMouse(1, 5);
fixture.detectChanges();
Expand All @@ -699,6 +708,7 @@ describe('Material Popover Edit', () => {

component.triggerHoverState();
fixture.detectChanges();
tick(200);

component.resizeColumnWithMouse(1, 5);
fixture.detectChanges();
Expand Down
Loading