initial
This commit is contained in:
26
apps/frontend/src/app/features/items/items.page.spec.ts
Normal file
26
apps/frontend/src/app/features/items/items.page.spec.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { of } from 'rxjs';
|
||||
import { ApiClientService } from '@boilerplate/api-client';
|
||||
import { ItemsPageComponent } from './items.page';
|
||||
|
||||
describe('ItemsPageComponent', () => {
|
||||
it('keeps the save button disabled while the typed form is invalid', async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ItemsPageComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: ApiClientService,
|
||||
useValue: {
|
||||
items: () => of({ items: [], total: 0, page: 1, pageSize: 20 }),
|
||||
},
|
||||
},
|
||||
],
|
||||
}).compileComponents();
|
||||
const fixture = TestBed.createComponent(ItemsPageComponent);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(fixture.componentInstance.form.invalid).toBe(true);
|
||||
fixture.componentInstance.form.controls.name.setValue('Neues Item');
|
||||
expect(fixture.componentInstance.form.valid).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user