Commit 4729a703 authored by Exbrayat Cédric's avatar Exbrayat Cédric
Browse files

fix: do not deactivate aggregations with a single option

Fixes #5
parent 5bd63bb5
......@@ -111,21 +111,6 @@ describe('SmallAggregationComponent', () => {
expect(component.aggregationForm.get('France').value).toBeTruthy();
});
it('should build a form and disable the unique criteria', () => {
// given an aggregation with a bucket and a unique value
const component = new SmallAggregationComponent();
component.aggregation = toAggregation('coo', ['France']);
// when initializing the component
component.ngOnInit();
// then it should have a form with one disabled field
const controls = component.aggregationForm.controls;
expect(Object.keys(controls)).toEqual(['France']);
// and France should be disabled
expect(component.aggregationForm.get('France').disable).toBeTruthy();
});
it('should emit an event when a checkbox is toggled', fakeAsync(() => {
const tester = new SmallAggregationComponentTester();
......
......@@ -43,10 +43,6 @@ export class SmallAggregationComponent implements OnInit {
}
this.aggregationForm.addControl(bucket.key, control);
});
// disable if only one bucket
if (buckets.length === 1) {
this.aggregationForm.disable();
}
// subscribe to form changes
// to emit a new event every time a value changes
......
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