Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'groupUUID',
(model.parent as DynamicFormArrayGroupModel).group) as DynamicSelectModel;
this.availableAccessConditionGroups.forEach((group) => {
groupOptions.push({
label: group.name,
value: group.uuid
})
});
// Due to a bug can't dynamically change the select options, so replace the model with a new one
const confGroup = { relation: groupModel.relation };
const groupsConfig = Object.assign({}, BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_CONFIG, confGroup);
groupsConfig.options = groupOptions;
model.parent.group.pop();
model.parent.group.push(new DynamicSelectModel(groupsConfig, BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_LAYOUT));
}
}
if (accessCondition.hasStartDate) {
const startDateModel = this.formBuilderService.findById(
'startDate',
(model.parent as DynamicFormArrayGroupModel).group) as DynamicDateControlModel;
const min = new Date(accessCondition.maxStartDate);
startDateModel.max = {
year: min.getFullYear(),
month: min.getMonth() + 1,
day: min.getDate()
};
}
if (accessCondition.hasEndDate) {
describe("DynamicIonicSelectComponent test suite", () => {
let testModel = new DynamicSelectModel({id: "select", options: [{value: "One"}, {value: "Two"}], value: "One"}),
formModel = [testModel],
formGroup: FormGroup,
fixture: ComponentFixture,
component: DynamicIonicSelectComponent,
debugElement: DebugElement,
testElement: DebugElement;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
ReactiveFormsModule,
NoopAnimationsModule,
IonicModule,
TextMaskModule,
accessConditionsArrayConfig.groupFactory = () => {
const type = new DynamicSelectModel(accessConditionTypeModel, BITSTREAM_FORM_ACCESS_CONDITION_TYPE_CLS);
const startDateConfig = Object.assign(BITSTREAM_FORM_ACCESS_CONDITION_START_DATE_CONFIG, confStart);
const endDateConfig = Object.assign(BITSTREAM_FORM_ACCESS_CONDITION_END_DATE_CONFIG, confEnd);
const groupsConfig = Object.assign(BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_CONFIG, confGroup);
const startDate = new DynamicDatePickerModel(startDateConfig, BITSTREAM_FORM_ACCESS_CONDITION_START_DATE_CLS);
const endDate = new DynamicDatePickerModel(endDateConfig, BITSTREAM_FORM_ACCESS_CONDITION_END_DATE_CLS);
const groups = new DynamicSelectModel(groupsConfig, BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_CLS);
return [type, startDate, endDate, groups];
};
accessConditionsArrayConfig.groupFactory = () => {
const type = new DynamicSelectModel(accessConditionTypeModelConfig, BITSTREAM_FORM_ACCESS_CONDITION_TYPE_LAYOUT);
const startDateConfig = Object.assign({}, BITSTREAM_FORM_ACCESS_CONDITION_START_DATE_CONFIG, confStart);
const endDateConfig = Object.assign({}, BITSTREAM_FORM_ACCESS_CONDITION_END_DATE_CONFIG, confEnd);
const groupsConfig = Object.assign({}, BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_CONFIG, confGroup);
const startDate = new DynamicDatePickerModel(startDateConfig, BITSTREAM_FORM_ACCESS_CONDITION_START_DATE_LAYOUT);
const endDate = new DynamicDatePickerModel(endDateConfig, BITSTREAM_FORM_ACCESS_CONDITION_END_DATE_LAYOUT);
const groups = new DynamicSelectModel(groupsConfig, BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_LAYOUT);
return [ type, startDate, endDate, groups ];
};
required: field_config.required,
disabled: field_config.read_only,
validators: {
external_validator: {
name: external_validator.name,
args: {id: id, errors: this._external_errors}
}
},
errorMessages: {
external_error: '{{external_error}}'
}
},
merge_layouts(field_config.layout, extra_layout)
);
case SimpleFieldTypes.SELECT:
return new DynamicSelectModel(
{
id: id,
placeholder: label,
options: (field_config as SelectFieldConfig).choices,
required: field_config.required,
disabled: field_config.read_only,
validators: {
external_validator: {
name: external_validator.name,
args: {id: id, errors: this._external_errors}
}
},
errorMessages: {
external_error: '{{external_error}}'
}
},
xdescribe("DynamicIonicSelectComponent test suite", () => {
let testModel = new DynamicSelectModel({id: "select", options: [{value: "One"}, {value: "Two"}], value: "One"}),
formModel = [testModel],
formGroup: FormGroup,
fixture: ComponentFixture,
component: DynamicIonicSelectComponent,
debugElement: DebugElement,
testElement: DebugElement;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
ReactiveFormsModule,
NoopAnimationsModule,
TextMaskModule,
DynamicFormsCoreModule
required: field_config.required,
disabled: field_config.read_only,
validators: {
external_validator: {
name: external_validator.name,
args: {id: id, errors: this._external_errors}
}
},
errorMessages: {
external_error: '{{external_error}}'
}
},
field_config.layout
);
case SimpleFieldTypes.SELECT:
return new DynamicSelectModel(
{
id: id,
placeholder: label,
options: (field_config as SelectFieldConfig).choices,
required: field_config.required,
disabled: field_config.read_only,
validators: {
external_validator: {
name: external_validator.name,
args: {id: id, errors: this._external_errors}
}
},
errorMessages: {
external_error: '{{external_error}}'
}
},
label: 'ISBN',
value: 'dc.identifier.isbn'
}
],
value: 'dc.identifier.issn'
};
export const qualdropInputConfig = {
name: 'dc.identifier_QUALDROP_VALUE',
id: 'dc_identifier_QUALDROP_VALUE',
readOnly: false,
disabled: false,
value: 'test'
};
export const mockQualdropSelectModel = new DynamicSelectModel(qualdropSelectConfig);
export const mockQualdropInputModel = new DsDynamicInputModel(qualdropInputConfig);
export const qualdropConfig = {
id: 'dc_identifier_QUALDROP_GROUP',
legend: 'Identifiers',
readOnly: false,
group: [mockQualdropSelectModel, mockQualdropInputModel]
};
export const MockQualdropModel = new DynamicQualdropModel(qualdropConfig);
const rowArrayQualdropConfig = {
id: 'row_QUALDROP_GROUP',
initialCount: 1,
notRepeatable: true,
groupFactory: () => {
describe("DynamicPrimeNGDropdownComponent test suite", () => {
let testModel = new DynamicSelectModel({id: "select", options: [{value: "One"}, {value: "Two"}], value: "One"}),
formModel = [testModel],
formGroup: FormGroup,
fixture: ComponentFixture,
component: DynamicPrimeNGDropdownComponent,
debugElement: DebugElement,
testElement: DebugElement;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
ReactiveFormsModule,
NoopAnimationsModule,
TextMaskModule,
DropdownModule,
describe("DynamicNGBootstrapSelectComponent test suite", () => {
let testModel = new DynamicSelectModel({id: "select", options: [{value: "One"}, {value: "Two"}], value: "One"}),
formModel = [testModel],
formGroup: FormGroup,
fixture: ComponentFixture,
component: DynamicNGBootstrapSelectComponent,
debugElement: DebugElement,
testElement: DebugElement;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
ReactiveFormsModule,
NoopAnimationsModule,
TextMaskModule,
DynamicFormsCoreModule