Commit 6668e08e authored by Tifenn Guillas's avatar Tifenn Guillas
Browse files

Merge branch 'tests-integration' into 'develop'

Fix sonar CI error

See merge request !64
parents 2fb3ade1 3f8c4d1f
Pipeline #1599 failed with stages
in 14 minutes
...@@ -54,10 +54,10 @@ sonar_scanner: ...@@ -54,10 +54,10 @@ sonar_scanner:
- sonar-scanner \ - sonar-scanner \
-Dsonar.projectKey=anis-client \ -Dsonar.projectKey=anis-client \
-Dsonar.sources=src \ -Dsonar.sources=src \
-Dsonar.projectVersion=$VERSION -Dsonar.projectVersion=$VERSION \
-Dsonar.host.url=$SONARQUBE_URL -Dsonar.host.url=$SONARQUBE_URL \
-Dsonar.login=$SONAR_TOKEN -Dsonar.login=$SONAR_TOKEN \
-Dsonar.exclusions=**.spec.ts -Dsonar.exclusions=**.spec.ts \
-Dsonar.typescript.lcov.reportPaths=./coverage/lcov.info -Dsonar.typescript.lcov.reportPaths=./coverage/lcov.info
cache: cache:
paths: paths:
......
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
<label class="col-3 col-form-label">{{label}}</label> <label class="col-3 col-form-label">{{label}}</label>
<div class="col"> <div class="col">
<div *ngFor="let cb of checkboxes.controls; let i=index" class="form-check form-check-inline"> <div *ngFor="let cb of checkboxes.controls; let i=index" class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="cb_{{_options[i].value}}" [formControl]="cb"> <input class="form-check-input" type="checkbox" id="cb_{{optionList[i].value}}" [formControl]="cb">
<label class="form-check-label" for="cb_{{_options[i].value}}">{{_options[i].label}}</label> <label class="form-check-label" for="cb_{{optionList[i].value}}">{{optionList[i].label}}</label>
</div> </div>
</div> </div>
<div class="col-2 text-center"> <div class="col-2 text-center">
<button class="btn btn-outline-success" *ngIf="!checkboxes.disabled" [hidden]="!isChecked()" (click)="addCriterion()"> <button class="btn btn-outline-success" *ngIf="!checkboxes.disabled" [hidden]="!isChecked()" (click)="emitAdd()">
<span class="fas fa-plus fa-fw"></span> <span class="fas fa-plus fa-fw"></span>
</button> </button>
<button class="btn btn-outline-danger" *ngIf="checkboxes.disabled" (click)="deleteCriterion()"> <button class="btn btn-outline-danger" *ngIf="checkboxes.disabled" (click)="emiteDelete()">
<span class="fa fa-times fa-fw"></span> <span class="fa fa-times fa-fw"></span>
</button> </button>
</div> </div>
......
...@@ -30,7 +30,7 @@ describe('[Search][Criteria][SearchType] Component: CheckboxComponent', () => { ...@@ -30,7 +30,7 @@ describe('[Search][Criteria][SearchType] Component: CheckboxComponent', () => {
{label: 'Three', value: 'three', display: 3} {label: 'Three', value: 'three', display: 3}
]; ];
component.setCheckboxes(options); component.setCheckboxes(options);
// console.log(component.checkboxes.get('0').value); // console.log(component.checkboxes.controls[0].value);
expect(component.checkboxes.length).toEqual(3); expect(component.checkboxes.length).toEqual(3);
}); });
......
...@@ -14,7 +14,7 @@ export class CheckboxComponent { ...@@ -14,7 +14,7 @@ export class CheckboxComponent {
@Input() label: string; @Input() label: string;
@Input() @Input()
set options(options: Option[]) { set options(options: Option[]) {
this._options = options; this.optionList = options;
this.setCheckboxes(options); this.setCheckboxes(options);
} }
@Input() @Input()
...@@ -25,14 +25,14 @@ export class CheckboxComponent { ...@@ -25,14 +25,14 @@ export class CheckboxComponent {
@Output() deleteCriterion: EventEmitter<number> = new EventEmitter(); @Output() deleteCriterion: EventEmitter<number> = new EventEmitter();
checkboxes: FormArray; checkboxes: FormArray;
checkboxesFormControls: {value: string, control: FormControl}[]; checkboxesFormControls: { value: string, control: FormControl }[];
_options: Option[]; optionList: Option[];
emitAdd() { emitAdd() {
const values: Option[] = []; const values: Option[] = [];
this.checkboxes.controls.forEach((formControl, i) => { this.checkboxes.controls.forEach((formControl, i) => {
if (formControl.value) { if (formControl.value) {
values.push(this._options[i]); values.push(this.optionList[i]);
} }
}); });
const cb = new SelectMultipleCriterion(this.id, values); const cb = new SelectMultipleCriterion(this.id, values);
...@@ -47,9 +47,10 @@ export class CheckboxComponent { ...@@ -47,9 +47,10 @@ export class CheckboxComponent {
this.checkboxesFormControls = []; this.checkboxesFormControls = [];
this.checkboxes = new FormArray(options.map((option: Option) => { this.checkboxes = new FormArray(options.map((option: Option) => {
const control = new FormControl(false); const control = new FormControl(false);
this.checkboxesFormControls.push({value: option.value, control}); this.checkboxesFormControls.push({ value: option.value, control });
return control; return control;
})); }));
// console.log(this.optionList);
} }
getDefault(criterion: Criterion): void { getDefault(criterion: Criterion): void {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment