Created
February 23, 2017 19:08
-
-
Save cranesandcaff/61afacd7f6d2a823436e93e7b0208079 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ReplaySubject } from 'rxjs/ReplaySubject'; | |
import { Directive, Injectable, NgModule } from '@angular/core'; | |
@Injectable() | |
export class DummyProvider { | |
constructor() {} | |
} | |
@Injectable() | |
export class Angulartics2Stub { | |
public pageTrack: ReplaySubject<any> = new ReplaySubject(10); | |
public eventTrack: ReplaySubject<any> = new ReplaySubject(10); | |
public exceptionTrack: ReplaySubject<any> = new ReplaySubject(10); | |
public setAlias: ReplaySubject<any> = new ReplaySubject(10); | |
public setUsername: ReplaySubject<any> = new ReplaySubject(10); | |
public setUserProperties: ReplaySubject<any> = new ReplaySubject(10); | |
public setUserPropertiesOnce: ReplaySubject<any> = new ReplaySubject(10); | |
public setSuperProperties: ReplaySubject<any> = new ReplaySubject(10); | |
public setSuperPropertiesOnce: ReplaySubject<any> = new ReplaySubject(10); | |
public userTimings: ReplaySubject<any> = new ReplaySubject(10); | |
trackLocation(){ | |
} | |
virtualPageviews(){ | |
} | |
excludeRoutes(){ | |
} | |
firstPageview(){ | |
} | |
withBase(){ | |
} | |
developerMode(){ | |
} | |
} | |
@Injectable() | |
@Directive({ | |
selector: '[angulartics2On]' | |
}) | |
export class Angulartics2OnStub { | |
eventTrack(){ | |
} | |
} | |
@Directive({ | |
selector: '[angularticsEvent]', | |
exportAs: 'angularticsEvent' | |
}) | |
export class AngularticsEventStub { | |
eventTrack(){ | |
} | |
} | |
@Directive({ | |
selector: '[angularticsProperties]', | |
exportAs: 'angularticsProperties' | |
}) | |
export class AngularticsPropertiesStub { | |
eventTrack(){ | |
} | |
} | |
@Directive({ | |
selector: '[angularticsCategory]', | |
exportAs: 'angularticsCategory' | |
}) | |
export class AngularticsCategoryStub { | |
eventTrack(){ | |
} | |
} | |
@NgModule({ | |
declarations: [ | |
Angulartics2OnStub, | |
AngularticsCategoryStub, | |
AngularticsEventStub, | |
AngularticsPropertiesStub | |
], | |
exports: [ | |
Angulartics2OnStub, | |
AngularticsCategoryStub, | |
AngularticsEventStub, | |
AngularticsPropertiesStub | |
] | |
}) | |
export class Angulartics2ModuleStub { | |
static forRoot(providers: Array<any>) { | |
return { | |
ngModule: Angulartics2ModuleStub, | |
providers: [ | |
Angulartics2Stub | |
] | |
}; | |
} | |
static forChild() { | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Only part of test | |
beforeEach(async(() => { | |
TestBed.configureTestingModule({ | |
declarations: [ | |
CalendarComponent, | |
CalendarHeaderComponent | |
], | |
imports: [ | |
Angulartics2ModuleStub.forRoot([ | |
DummyProvider | |
]) | |
] | |
}) | |
.overrideDirective(Angulartics2On, Angulartics2OnStub) | |
.compileComponents(); | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment