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

100% Statements 10/10
100% Branches 0/0
100% Functions 3/3
100% Lines 9/9

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 305x 5x       5x 5x 5x                 5x     7x     7x       1x      
import { Component, OnInit } from "@angular/core"
import { Store } from "@ngrx/store"
import { Observable } from "rxjs"
import { CcState } from "../../../../codeCharta.model"
 
import { toggleSortingOrderAscending } from "../../../../state/store/appSettings/sortingOrderAscending/sortingOrderAscending.actions"
import { sortingOrderAscendingSelector } from "../../../../state/store/appSettings/sortingOrderAscending/sortingOrderAscending.selector"
import { AsyncPipe } from "@angular/common"
 
@Component({
    selector: "cc-sorting-button",
    templateUrl: "./sortingButton.component.html",
    styleUrls: ["./sortingButton.component.scss"],
    standalone: true,
    imports: [AsyncPipe]
})
export class SortingButtonComponent implements OnInit {
    sortingOrderAscending$: Observable<boolean>
 
    constructor(private store: Store<CcState>) {}
 
    ngOnInit(): void {
        this.sortingOrderAscending$ = this.store.select(sortingOrderAscendingSelector)
    }
 
    onClick() {
        this.store.dispatch(toggleSortingOrderAscending())
    }
}