<commit_before>import {Component, Input, Output, EventEmitter, OnInit, AfterViewInit} from '@angular/core';
import {TestGroup, Test} from "../model/tests";

@Component({
    selector: "test-listgroup",
    template: `<div *ngIf="groups.length == 0">
  <div class="group-heading">
    <h3 class="group-title"><i class="fa fa-cubes"></i> No tests found</h3>
  </div>
</div>

<div *ngFor="let group of groups">
  <div (click)="activate(group.name)" class="group-heading clickable">
    <h3 class="group-title"><i class="fa fa-cubes"></i> {{group.name}} <i *ngIf="isActive(group.name)" class="fa fa-caret-down pull-right"></i></h3>
  </div>
  <div>
    <ul *ngIf="isActive(group.name)" class="list-group">
      <li *ngFor="let test of group.tests" class="list-group-item clickable" (click)="open(test)"><span><i class="fa fa-file-text-o"></i> {{test.name}}</span></li>
    </ul>
  </div>
</div>`
})
export class TestListGroupComponent {

    @Input() groups: TestGroup[] = [];

    @Output() selected = new EventEmitter(true);

    activeGroup: string = "";

    activate(groupName : string) {
        if (this.activeGroup.length > 1 && this.activeGroup == groupName) {
            this.activeGroup = "";
        } else {
            this.activeGroup = groupName;
        }
    }

    isActive(groupName: string) {
        return this.activeGroup.length == 1 || this.activeGroup == groupName;
    }

    open(test: Test) {
        this.selected.emit(test);
    }
}<commit_msg>Fixed auto open test group when only one single group available<commit_after>import {Component, Input, Output, EventEmitter, OnInit, AfterViewInit} from '@angular/core';
import {TestGroup, Test} from "../model/tests";

@Component({
    selector: "test-listgroup",
    template: `<div *ngIf="groups.length == 0">
  <div class="group-heading">
    <h3 class="group-title"><i class="fa fa-cubes"></i> No tests found</h3>
  </div>
</div>

<div *ngFor="let group of groups">
  <div (click)="activate(group.name)" class="group-heading clickable">
    <h3 class="group-title"><i class="fa fa-cubes"></i> {{group.name}} <i *ngIf="isActive(group.name)" class="fa fa-caret-down pull-right"></i></h3>
  </div>
  <div>
    <ul *ngIf="isActive(group.name)" class="list-group">
      <li *ngFor="let test of group.tests" class="list-group-item clickable" (click)="open(test)"><span><i class="fa fa-file-text-o"></i> {{test.name}}</span></li>
    </ul>
  </div>
</div>`
})
export class TestListGroupComponent {

    @Input() groups: TestGroup[] = [];

    @Output() selected = new EventEmitter(true);

    activeGroup: string = "";

    activate(groupName : string) {
        if (this.groups.length > 1 && this.activeGroup == groupName) {
            this.activeGroup = "";
        } else {
            this.activeGroup = groupName;
        }
    }

    isActive(groupName: string) {
        return this.groups.length == 1 || this.activeGroup == groupName;
    }

    open(test: Test) {
        this.selected.emit(test);
    }
}
{'fraction_non_alphanumeric': 0.19022103148024114, 'fraction_numerical': 0.004688546550569324, 'mean_word_length': 3.412112259970458, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1699112', 'n_tokens_mistral': 1005, 'n_tokens_neox': 981, 'n_words': 216}