feat: add persistance to language selection
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ContactForm } from './contact-form';
|
||||
import { STRINGS_INJECTOR } from '../../app.config';
|
||||
import { strings } from '../../strings';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { ContactDTO } from '../../models/ContactDTO';
|
||||
import { LanguageManager } from '../../services/language-manager';
|
||||
|
||||
describe('ContactForm', () => {
|
||||
let component: ContactForm;
|
||||
let fixture: ComponentFixture<ContactForm>;
|
||||
let languageManager: jasmine.SpyObj<LanguageManager>;
|
||||
|
||||
beforeEach(async () => {
|
||||
languageManager = jasmine.createSpyObj(LanguageManager.name, [], { strings: strings.en });
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ContactForm],
|
||||
providers: [{ provide: STRINGS_INJECTOR, useValue: strings }],
|
||||
providers: [{ provide: LanguageManager, useValue: languageManager }],
|
||||
}).compileComponents();
|
||||
|
||||
TestBed.inject(STRINGS_INJECTOR);
|
||||
fixture = TestBed.createComponent(ContactForm);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -1,30 +1,33 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ContactListTable } from './contact-list-table';
|
||||
import { STRINGS_INJECTOR } from '../../app.config';
|
||||
import { strings } from '../../strings';
|
||||
import { ContactService } from '../../services/contact.service';
|
||||
import { ContactDTO } from '../../models/ContactDTO';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { of } from 'rxjs';
|
||||
import { Router } from '@angular/router';
|
||||
import { LanguageManager } from '../../services/language-manager';
|
||||
|
||||
describe('ContactListTable', () => {
|
||||
let component: ContactListTable;
|
||||
let fixture: ComponentFixture<ContactListTable>;
|
||||
|
||||
let contactService: jasmine.SpyObj<ContactService>;
|
||||
let languageManager: jasmine.SpyObj<LanguageManager>;
|
||||
let router: jasmine.SpyObj<Router>;
|
||||
let CONTACT_LIST_MOCK: ContactDTO[];
|
||||
|
||||
beforeEach(async () => {
|
||||
contactService = jasmine.createSpyObj(ContactService.name, ['delete']);
|
||||
languageManager = jasmine.createSpyObj(LanguageManager.name, [], { strings: strings.en });
|
||||
router = jasmine.createSpyObj(Router.name, ['navigate']);
|
||||
CONTACT_LIST_MOCK = [new ContactDTO(1, 'MOCK', 'MOCK', '5491122222222')];
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ContactListTable],
|
||||
providers: [
|
||||
{ provide: STRINGS_INJECTOR, useValue: strings },
|
||||
{ provide: ContactService, useValue: contactService },
|
||||
{ provide: LanguageManager, useValue: languageManager },
|
||||
{ provide: Router, useValue: router },
|
||||
],
|
||||
}).compileComponents();
|
||||
|
||||
@@ -3,21 +3,24 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ContactList } from './contact-list';
|
||||
import { ContactService } from '../../services/contact.service';
|
||||
import { of } from 'rxjs';
|
||||
import { STRINGS_INJECTOR } from '../../app.config';
|
||||
import { strings } from '../../strings';
|
||||
import { LanguageManager } from '../../services/language-manager';
|
||||
|
||||
describe('ContactList', () => {
|
||||
let component: ContactList;
|
||||
let fixture: ComponentFixture<ContactList>;
|
||||
let contactService: jasmine.SpyObj<ContactService>;
|
||||
let languageManager: jasmine.SpyObj<LanguageManager>;
|
||||
|
||||
beforeEach(async () => {
|
||||
contactService = jasmine.createSpyObj(ContactService.name, ['getAll']);
|
||||
languageManager = jasmine.createSpyObj(LanguageManager.name, [], { strings: strings.en });
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ContactList],
|
||||
providers: [
|
||||
{ provide: ContactService, useValue: contactService },
|
||||
{ provide: STRINGS_INJECTOR, useValue: strings },
|
||||
{ provide: LanguageManager, useValue: languageManager },
|
||||
],
|
||||
}).compileComponents();
|
||||
contactService.getAll.and.returnValue(of([]));
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ContactSearchBar } from './contact-search-bar';
|
||||
import { STRINGS_INJECTOR } from '../../app.config';
|
||||
import { strings } from '../../strings';
|
||||
import { LanguageManager } from '../../services/language-manager';
|
||||
|
||||
describe('ContactSearchBar', () => {
|
||||
let component: ContactSearchBar;
|
||||
let fixture: ComponentFixture<ContactSearchBar>;
|
||||
|
||||
let languageManager: jasmine.SpyObj<LanguageManager>;
|
||||
|
||||
beforeEach(async () => {
|
||||
languageManager = jasmine.createSpyObj(LanguageManager.name, [], { strings: strings.en });
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ContactSearchBar],
|
||||
providers: [{provide: STRINGS_INJECTOR, useValue: strings}]
|
||||
})
|
||||
.compileComponents();
|
||||
providers: [{ provide: LanguageManager, useValue: languageManager }],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ContactSearchBar);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
Reference in New Issue
Block a user