All files / app/codeCharta/ui/ribbonBar/searchPanel/sortingOption sortingOption.component.ts

100% Statements 14/14
100% Branches 0/0
100% Functions 2/2
100% Lines 13/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 315x 5x     5x 5x 5x 5x 5x 5x                 5x 7x     7x 7x       1x      
import { Component } from "@angular/core"
import { Store } from "@ngrx/store"
import { Observable } from "rxjs"
 
import { CcState, SortingOption } from "../../../../codeCharta.model"
import { setSortingOption } from "../../../../state/store/dynamicSettings/sortingOption/sortingOption.actions"
import { sortingOrderSelector } from "../../../../state/store/dynamicSettings/sortingOption/sortingOrder.selector"
import { MatSelect } from "@angular/material/select"
import { MatOption } from "@angular/material/core"
import { AsyncPipe } from "@angular/common"
 
@Component({
    selector: "cc-sorting-option",
    templateUrl: "./sortingOption.component.html",
    styleUrls: ["./sortingOption.component.scss"],
    standalone: true,
    imports: [MatSelect, MatOption, AsyncPipe]
})
export class SortingOptionComponent {
    sortingOptions = Object.values(SortingOption)
    selectedSortingOption$: Observable<SortingOption>
 
    constructor(private store: Store<CcState>) {
        this.selectedSortingOption$ = store.select(sortingOrderSelector)
    }
 
    handleSelectedSortingOptionChanged(event) {
        this.store.dispatch(setSortingOption(event.value))
    }
}