expect(component.userConfig.limit).toBe(1);
});
+ it('should prevent propagation of mouseenter event', (done) => {
+ fixture.detectChanges();
+ const mouseEvent = new MouseEvent('mouseenter');
+ mouseEvent.stopPropagation = () => done();
+ fixture.debugElement.nativeElement.dispatchEvent(mouseEvent);
+ });
+
describe('test search', () => {
const expectSearch = (keyword: string, expectedResult: object[]) => {
component.search = keyword;
import {
AfterContentChecked,
+ ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
EventEmitter,
@Component({
selector: 'cd-table',
templateUrl: './table.component.html',
- styleUrls: ['./table.component.scss']
+ styleUrls: ['./table.component.scss'],
+ changeDetection: ChangeDetectionStrategy.OnPush
})
export class TableComponent implements AfterContentChecked, OnInit, OnChanges, OnDestroy {
@ViewChild(DatatableComponent)
}
ngOnInit() {
+ // ngx-datatable triggers calculations each time mouse enters a row,
+ // this will prevent that.
+ window.addEventListener(
+ 'mouseenter',
+ function(event) {
+ event.stopPropagation();
+ },
+ true
+ );
+
this._addTemplates();
if (!this.sorts) {
// Check whether the specified identifier exists.