Created
October 24, 2018 12:40
-
-
Save topnotch48/e24ae0c3468cb7d5b2bf157ae6810eb3 to your computer and use it in GitHub Desktop.
init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function initComponent<TValue, TComponent extends FieldEditorComponent<TValue>>(c: { new (...args: any[]): TComponent }, | |
wellKnownField: WellKnownField, | |
criteriaValue: any, | |
valueChangeHandler: (e: FieldEditorValueChangeEvent<TValue>) => void | |
): TestCtx<TComponent> { | |
let testCtx = createTestContext(c); | |
tick(); | |
let field = (<MatterContext>TestBed.get(MatterContext)).matterDefinition!.fieldsDefinition.getWellKnownField(wellKnownField); | |
let fc = FieldCriteriaFactory.buildCriteria(field, SearchFieldOperator.EQ, criteriaValue); | |
(<any>testCtx.component).value = fc.value; | |
(<any>testCtx.component).valueChange.subscribe(valueChangeHandler); | |
testCtx.fixture.detectChanges(); | |
return testCtx; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment