function getChecklistInstance(validationValues) { let fieldsMap = { field1: new DefinitionModelProperty({ identifier: 'field1', multivalue: true, value: 'val' }) }; CodelistList.prototype.formWrapper = { getViewModel: sinon.stub.returns(fieldsMap), fieldsMap, formConfig: { models: { validationModel: new InstanceModel({ field1: { value: validationValues || 'value' }, codelistFilters: {} }) } }, config: { formViewMode: 'preview' }, objectDataForm: {} }; CodelistList.prototype.identifier = 'field1'; let codelistRestService = stub(CodelistRestService); codelistRestService.getCodelist.returns(PromiseStub.resolve({data: [{value: 'key', label: 'label'}]})); let codelistFilterProvider = stub(CodelistFilterProvider); return new CodelistList(IdocMocks.mockScope(), IdocMocks.mockElement(), IdocMocks.mockTimeout(), codelistRestService, codelistFilterProvider); }
it('should not emit event by default to formWrapper', () => { let codelistList = getChecklistInstance(); codelistList.formEventEmitter = stub(EventEmitter); codelistList.ngAfterViewInit(); expect(codelistList.formEventEmitter.publish.calledOnce).to.be.true; });
it('should not emit event by default to formWrapper', () => { let datetime = new Datetime(configService, $scope); datetime.formEventEmitter = stub(EventEmitter); datetime.ngAfterViewInit(); expect(datetime.formEventEmitter.publish.calledOnce).to.be.true; });