Skip to content

Commit 3932314

Browse files
committed
[DSC-2397] Fix lint
1 parent 369df31 commit 3932314

2 files changed

Lines changed: 57 additions & 56 deletions

File tree

src/app/shared/form/builder/ds-dynamic-form-ui/models/dynamic-vocabulary.component.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import {
2121
distinctUntilChanged,
2222
filter,
2323
map,
24-
take, tap,
24+
take,
25+
tap,
2526
} from 'rxjs/operators';
2627

2728
import { Metadata } from '../../../../../core/shared/metadata.utils';
@@ -307,7 +308,7 @@ export abstract class DsDynamicVocabularyComponent extends DynamicFormControlCom
307308
return null;
308309
}
309310

310-
let returnValue = [];
311+
const returnValue = [];
311312
if (value.indexOf('|||') === -1) {
312313
returnValue.push(this.generateFormField(value));
313314
} else if (value.indexOf('|||') !== -1 && this.otherInfoValue) {
@@ -317,7 +318,7 @@ export abstract class DsDynamicVocabularyComponent extends DynamicFormControlCom
317318
} else {
318319
const unformattedValue = this.otherInfoValuesUnformatted.find(otherInfoValue => otherInfoValue.includes(this.otherInfoValue || this.otherName));
319320
const authorityValue = hasValue(unformattedValue) ? unformattedValue.substring(unformattedValue.lastIndexOf('::') + 2) : null;
320-
let otherInfo = {};
321+
const otherInfo = {};
321322
let alternativeValue: string;
322323
otherInfo[key] = value;
323324
if (hasValue(this.otherName)) {
@@ -331,7 +332,7 @@ export abstract class DsDynamicVocabularyComponent extends DynamicFormControlCom
331332
null,
332333
null,
333334
null,
334-
otherInfo
335+
otherInfo,
335336
));
336337
}
337338
}
@@ -346,7 +347,7 @@ export abstract class DsDynamicVocabularyComponent extends DynamicFormControlCom
346347
value.substring(0, value.lastIndexOf('::')),
347348
null,
348349
null,
349-
value.substring(value.lastIndexOf('::') + 2)
350+
value.substring(value.lastIndexOf('::') + 2),
350351
);
351352
}
352353
}

src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.spec.ts

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ describe('DsDynamicOneboxComponent test suite', () => {
104104

105105
let scheduler: TestScheduler;
106106
let testComp: TestComponent;
107-
let oneboxComponent: DsDynamicOneboxComponent|any;
107+
let oneboxComponent: DsDynamicOneboxComponent;
108108
let testFixture: ComponentFixture<TestComponent>;
109109
let debugElement: DebugElement;
110110
let oneboxCompFixture: ComponentFixture<DsDynamicOneboxComponent>;
@@ -571,65 +571,65 @@ describe('DsDynamicOneboxComponent test suite', () => {
571571
});
572572
});
573573

574-
describe('test metadata enrichment', () => {
575-
beforeEach(() => {
576-
oneboxCompFixture = TestBed.createComponent(DsDynamicOneboxComponent);
577-
debugElement = oneboxCompFixture.debugElement;
578-
oneboxComponent = oneboxCompFixture.componentInstance;
579-
oneboxComponent.currentValue = new FormFieldMetadataValueObject('test', null, null, null, 'testDisplay');
580-
oneboxComponent.model = new DynamicOneboxModel(ONEBOX_TEST_MODEL_CONFIG);
574+
describe('test metadata enrichment', () => {
575+
beforeEach(() => {
576+
oneboxCompFixture = TestBed.createComponent(DsDynamicOneboxComponent);
577+
debugElement = oneboxCompFixture.debugElement;
578+
oneboxComponent = oneboxCompFixture.componentInstance;
579+
oneboxComponent.currentValue = new FormFieldMetadataValueObject('test', null, null, null, 'testDisplay');
580+
oneboxComponent.model = new DynamicOneboxModel(ONEBOX_TEST_MODEL_CONFIG);
581581

582-
spyOn(oneboxComponent, 'onSelectItem').and.returnValue(undefined);
583-
spyOn(oneboxComponent, 'toggleOtherInfoSelection').and.returnValue(undefined);
584-
});
582+
spyOn(oneboxComponent, 'onSelectItem').and.returnValue(undefined);
583+
spyOn(oneboxComponent, 'toggleOtherInfoSelection').and.returnValue(undefined);
584+
});
585585

586586

587-
it('should return null if value is empty', () => {
588-
expect(oneboxComponent.getOtherInformationValue('', 'some-key')).toBeNull();
589-
});
587+
it('should return null if value is empty', () => {
588+
expect(oneboxComponent.getOtherInformationValue('', 'some-key')).toBeNull();
589+
});
590590

591-
it('should return null if key is "alternative-names"', () => {
592-
expect(oneboxComponent.getOtherInformationValue('some-value', 'alternative-names')).toBeNull();
593-
});
591+
it('should return null if key is "alternative-names"', () => {
592+
expect(oneboxComponent.getOtherInformationValue('some-value', 'alternative-names')).toBeNull();
593+
});
594594

595-
it('should return single FormFieldMetadataValueObject if no "|||" in value', () => {
596-
const result = oneboxComponent.getOtherInformationValue('value::authority', 'some-key');
597-
expect(result.length).toBe(1);
598-
expect(result[0]).toEqual(jasmine.any(FormFieldMetadataValueObject));
599-
expect(result[0].value).toBe('value');
600-
expect(result[0].authority).toBe('authority');
601-
});
595+
it('should return single FormFieldMetadataValueObject if no "|||" in value', () => {
596+
const result = oneboxComponent.getOtherInformationValue('value::authority', 'some-key');
597+
expect(result.length).toBe(1);
598+
expect(result[0]).toEqual(jasmine.any(FormFieldMetadataValueObject));
599+
expect(result[0].value).toBe('value');
600+
expect(result[0].authority).toBe('authority');
601+
});
602602

603-
it('should handle multiple values with multiValueOnGenerator true', () => {
604-
oneboxComponent.multiValueOnGenerator = true;
605-
oneboxComponent.otherInfoValue = 'someValue';
606-
const result = oneboxComponent.getOtherInformationValue('val1::auth1|||val2::auth2', 'some-key');
607-
expect(result.length).toBe(2);
608-
expect(result[0].value).toBe('val1');
609-
expect(result[0].authority).toBe('auth1');
610-
expect(result[1].value).toBe('val2');
611-
expect(result[1].authority).toBe('auth2');
612-
});
603+
it('should handle multiple values with multiValueOnGenerator true', () => {
604+
oneboxComponent.multiValueOnGenerator = true;
605+
(oneboxComponent as any).otherInfoValue = 'someValue';
606+
const result = oneboxComponent.getOtherInformationValue('val1::auth1|||val2::auth2', 'some-key');
607+
expect(result.length).toBe(2);
608+
expect(result[0].value).toBe('val1');
609+
expect(result[0].authority).toBe('auth1');
610+
expect(result[1].value).toBe('val2');
611+
expect(result[1].authority).toBe('auth2');
612+
});
613613

614-
it('should handle multiple values with multiValueOnGenerator false', () => {
615-
oneboxComponent.multiValueOnGenerator = false;
616-
oneboxComponent.otherInfoValue = 'val1';
617-
oneboxComponent.otherInfoValuesUnformatted = ['val1::auth1'];
618-
const result = oneboxComponent.getOtherInformationValue('val1::auth1|||val2::auth2', 'data-key');
619-
expect(result.length).toBe(1);
620-
expect(result[0].value).toBe('val1');
621-
expect(result[0].authority).toBe('auth1');
622-
expect(result[0].otherInformation['data-key']).toBe('val1::auth1|||val2::auth2');
623-
});
614+
it('should handle multiple values with multiValueOnGenerator false', () => {
615+
oneboxComponent.multiValueOnGenerator = false;
616+
(oneboxComponent as any).otherInfoValue = 'val1';
617+
oneboxComponent.otherInfoValuesUnformatted = ['val1::auth1'];
618+
const result = oneboxComponent.getOtherInformationValue('val1::auth1|||val2::auth2', 'data-key');
619+
expect(result.length).toBe(1);
620+
expect(result[0].value).toBe('val1');
621+
expect(result[0].authority).toBe('auth1');
622+
expect(result[0].otherInformation['data-key']).toBe('val1::auth1|||val2::auth2');
623+
});
624624

625-
it('should handle value without "::"', () => {
626-
const result = oneboxComponent.getOtherInformationValue('simpleValue', 'some-key');
627-
expect(result.length).toBe(1);
628-
expect(result[0].value).toBe('simpleValue');
629-
expect(result[0].authority).toBeNull();
630-
});
625+
it('should handle value without "::"', () => {
626+
const result = oneboxComponent.getOtherInformationValue('simpleValue', 'some-key');
627+
expect(result.length).toBe(1);
628+
expect(result[0].value).toBe('simpleValue');
629+
expect(result[0].authority).toBeNull();
630+
});
631631

632-
});
632+
});
633633
});
634634
});
635635

0 commit comments

Comments
 (0)