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

fix: do not deactivate large aggregations with a single option

parent b537ffe3
......@@ -11,25 +11,16 @@
<small class="text-muted ml-1">({{ aggregation.buckets.length | number }})</small>
<!-- multiple values as pills and a typeahead to add them -->
<div *ngIf="aggregation.buckets.length > 1; else singleValue">
<div class="mb-2">
<!-- values as pills and a typeahead to add them -->
<div class="mb-2">
<span class="badge badge-pill badge-secondary mr-1" *ngFor="let key of selectedKeys" tabindex="0"
<rare-document-count [name]="key" [count]="documentCountForKey(key)" [muted]="false"></rare-document-count>
<button tabindex="-1" type="button" class="btn btn-link" (click)="removeKey(key)">&times;</button>
<input id="typeahead-basic" type="text" class="form-control" [formControl]="criterion" [ngbTypeahead]="search"
(selectItem)="selectKey($event)" [resultTemplate]="resultTemplate"/>
<!-- single value as a pill not removable -->
<ng-template #singleValue>
<span class="badge badge-pill badge-light">
<rare-document-count [name]="aggregation.buckets[0].key" [count]="aggregation.buckets[0].documentCount"
<input class="form-control" [formControl]="criterion" [ngbTypeahead]="search"
(selectItem)="selectKey($event)" [resultTemplate]="resultTemplate"/>
......@@ -122,25 +122,6 @@ describe('LargeAggregationComponent', () => {
it('should disable the unique criterion and display it as a pill', () => {
// given an aggregation with a bucket and a unique value
const tester = new LargeAggregationComponentTester();
const component = tester.componentInstance;
component.aggregation = toAggregation('coo', ['France']);
// when displaying the component
// then it should have no input
// and France should be displayed a pill
// but not a removable one
it('should find one results containing the term entered', () => {
// given an aggregation with a bucket
const component = new LargeAggregationComponent();
Supports Markdown
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