@ngx-translate/core#TranslateStore TypeScript Examples

The following examples show how to use @ngx-translate/core#TranslateStore. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: app.component.spec.ts    From ledge with Mozilla Public License 2.0 5 votes vote down vote up
describe('AppComponent', () => {
  let component: AppComponent;
  let fixture: ComponentFixture<AppComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [
        RouterTestingModule,
        MatMenuModule,
        CustomMaterialModule,
        BrowserAnimationsModule,
        SharedModule,
        TranslateModule.forRoot({
          loader: {
            provide: TranslateLoader,
            useClass: TranslateFakeLoader,
          },
        }),
      ],
      declarations: [AppComponent],
      providers: [TranslateService, TranslateStore],
    }).compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(AppComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create the app', () => {
    const app = fixture.debugElement.componentInstance;
    expect(app).toBeTruthy();
  });

  it(`should have as title 'clean-angular'`, () => {
    const app = fixture.debugElement.componentInstance;
    expect(app.title).toEqual('ledge');
  });

  it('should call window.open when click link', () => {
    spyOn(window, 'open');

    component.openLink('https://devops.phdoal.com');

    expect(window.open).toHaveBeenCalled();
  });

  it('should enable set language', () => {
    component.setLanguage('zh-cn');

    expect(component.translate.currentLang).toEqual('zh-cn');
  });
});