Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

46 lines
1.1 KiB

/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { FormControl, Validators } from '@angular/forms';
import { value$ } from './forms-helper';
describe('FormHelpers', () => {
describe('value$', () => {
it('should provide change values', () => {
const form = new FormControl('1', Validators.required);
const values: any[] = [];
value$(form).subscribe(x => {
values.push(x);
});
form.setValue('2');
form.setValue('3');
expect(values).toEqual(['1', '2', '3']);
});
it('should not trigger on disable', () => {
const form = new FormControl('1', Validators.required);
const values: any[] = [];
value$(form).subscribe(x => {
values.push(x);
});
form.setValue('2');
form.enable();
form.setValue('3');
form.disable();
expect(values).toEqual(['1', '2', '3']);
});
});
});