Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const cTeardown = Chain.op(() => {
TestBed.resetTestingModule();
});
Pipeline.async({}, [
Log.chainsAsStep('', 'should be pristine, untouched, and valid initially', [
cSetup,
Chain.op((v) => {
Assertions.assertEq('ngModel should be valid', true, v.ngModel.valid);
Assertions.assertEq('ngModel should be pristine', true, v.ngModel.pristine);
Assertions.assertEq('ngModel should not be touched', false, v.ngModel.touched);
}),
cTeardown
]),
Log.chainsAsStep('', 'should be pristine, untouched, and valid after writeValue', [
cSetup,
Chain.op((v) => {
v.editorComponent.writeValue('New Value');
v.fixture.detectChanges();
Assertions.assertEq('ngModel should be valid', true, v.ngModel.valid);
Assertions.assertEq('ngModel should be pristine', true, v.ngModel.pristine);
Assertions.assertEq('ngModel should not be touched', false, v.ngModel.touched);
Assertions.assertEq(
'Value should have been written to the editor',
v.editorComponent.editor.getContent({ format: 'text' }),
'New Value'
);
}),
cTeardown
editorComponent.onInit.subscribe(() => {
editorComponent.editor.on('SkinLoaded', () => {
setTimeout(() => {
next({ fixture, editorDebugElement, editorComponent, ngModel });
}, 0);
});
});
});
const cTeardown = Chain.op(() => {
TestBed.resetTestingModule();
});
Pipeline.async({}, [
Log.chainsAsStep('', 'should be pristine, untouched, and valid initially', [
cSetup,
Chain.op((v) => {
Assertions.assertEq('ngModel should be valid', true, v.ngModel.valid);
Assertions.assertEq('ngModel should be pristine', true, v.ngModel.pristine);
Assertions.assertEq('ngModel should not be touched', false, v.ngModel.touched);
}),
cTeardown
]),
Log.chainsAsStep('', 'should be pristine, untouched, and valid after writeValue', [
cSetup,
Chain.op((v) => {
v.editorComponent.writeValue('New Value');
v.fixture.detectChanges();
Assertions.assertEq('ngModel should be valid', true, v.ngModel.valid);