mirror of
https://github.com/ceph/ceph
synced 2025-01-20 01:51:34 +00:00
Merge pull request #28879 from Devp00l/wip-40580
mgr/dashboard: Fix the table mouseenter event handling test Reviewed-by: Patrick Nawracay <pnawracay@suse.com> Reviewed-by: Tiago Melo <tmelo@suse.com>
This commit is contained in:
commit
d4049a5ad6
@ -87,10 +87,18 @@ describe('TableComponent', () => {
|
||||
});
|
||||
|
||||
it('should prevent propagation of mouseenter event', (done) => {
|
||||
fixture.detectChanges();
|
||||
let wasCalled = false;
|
||||
const mouseEvent = new MouseEvent('mouseenter');
|
||||
mouseEvent.stopPropagation = () => done();
|
||||
fixture.debugElement.nativeElement.dispatchEvent(mouseEvent);
|
||||
mouseEvent.stopPropagation = () => {
|
||||
wasCalled = true;
|
||||
};
|
||||
spyOn(window, 'addEventListener').and.callFake((eventName, fn) => {
|
||||
fn(mouseEvent);
|
||||
expect(eventName).toBe('mouseenter');
|
||||
expect(wasCalled).toBe(true);
|
||||
done();
|
||||
});
|
||||
component.ngOnInit();
|
||||
});
|
||||
|
||||
describe('test search', () => {
|
||||
|
@ -179,14 +179,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
|
||||
ngOnInit() {
|
||||
// ngx-datatable triggers calculations each time mouse enters a row,
|
||||
// this will prevent that.
|
||||
window.addEventListener(
|
||||
'mouseenter',
|
||||
function(event) {
|
||||
event.stopPropagation();
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
window.addEventListener('mouseenter', (event) => event.stopPropagation(), true);
|
||||
this._addTemplates();
|
||||
if (!this.sorts) {
|
||||
// Check whether the specified identifier exists.
|
||||
|
Loading…
Reference in New Issue
Block a user