Fixed server side form validation

This commit is contained in:
Giuseppe Digilio
2018-07-09 19:02:09 +02:00
parent 499b5bf51b
commit 4d89674cda
8 changed files with 95 additions and 36 deletions

View File

@@ -22,6 +22,7 @@ import { FormState } from './form.reducer';
import { FormChangeAction, FormStatusChangeAction } from './form.actions';
import { MockStore } from '../testing/mock-store';
import { FormFieldMetadataValueObject } from './builder/models/form-field-metadata-value.model';
import { GLOBAL_CONFIG } from '../../../config';
function createTestComponent<T>(html: string, type: { new(...args: any[]): T }): ComponentFixture<T> {
TestBed.overrideComponent(type, {
@@ -102,11 +103,19 @@ export const TEST_FORM_MODEL_WITH_ARRAY = [
];
describe('FormComponent test suite', () => {
let testComp: TestComponent;
let formComp: FormComponent;
let testFixture: ComponentFixture<TestComponent>;
let formFixture: ComponentFixture<FormComponent>;
const config = {
form: {
validatorMap: {
required: 'required',
regex: 'pattern'
}
}
} as any;
const formState: FormState = {
testForm: {
data: {
@@ -146,6 +155,7 @@ describe('FormComponent test suite', () => {
FormBuilderService,
FormComponent,
FormService,
{provide: GLOBAL_CONFIG, useValue: config},
{
provide: Store, useValue: store
}