Skip to content

Commit

Permalink
Fix appointments for dxSheduler widget (#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
ovchinnikov committed Apr 19, 2018
1 parent 19e3428 commit 0f5d883
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 46 deletions.
25 changes: 3 additions & 22 deletions src/core/integration.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,13 @@

import { NgModule, NgZone, Inject } from '@angular/core';
import { NgModule, Inject } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { NgHttp } from './http-request';

import * as domAdapter from 'devextreme/core/dom_adapter';
import * as readyCallbacks from 'devextreme/core/utils/ready_callbacks';
import * as eventsEngine from 'devextreme/events/core/events_engine';

@NgModule({
providers: [ NgHttp ]
})
@NgModule({})
export class DxIntegrationModule {
constructor(@Inject(DOCUMENT) document: any, ngZone: NgZone, _ngHttp: NgHttp) {
this.initEvents(ngZone);
this.initDomAdapter(document);
}

private initEvents(ngZone: NgZone) {
eventsEngine.set({
on: function(...args) {
ngZone.runOutsideAngular(() => {
this.callBase.apply(this, args);
});
}
});
}

private initDomAdapter(document: any) {
constructor(@Inject(DOCUMENT) document: any) {
domAdapter.inject({
_document: document,

Expand Down
24 changes: 0 additions & 24 deletions tests/src/ui/list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,28 +548,4 @@ describe('DxList', () => {
expect(DxButton['getInstance'](elements[0])).not.toBeUndefined();
expect(DxButton['getInstance'](elements[1])).not.toBeUndefined();
}));

it('widget events should subscribe on native events outside NgZone', () => {
TestBed.overrideComponent(TestContainerComponent, {
set: {
template: `<dx-list [items]="items"></dx-list>`
}
});

let fixture = TestBed.createComponent(TestContainerComponent);
fixture.autoDetectChanges();

let instance = getWidget(fixture);
let onChangesSpy = spyOn(fixture.componentInstance, 'ngAfterViewChecked');

expect(onChangesSpy.calls.count()).toBe(0);
instance.element().dispatchEvent(new Event('mouseover'));

expect(onChangesSpy.calls.count()).toBe(0);
let item = instance.element().querySelector('.dx-item');
item.click();

expect(onChangesSpy.calls.count()).toBe(0);
fixture.autoDetectChanges(false);
});
});

0 comments on commit 0f5d883

Please sign in to comment.