All files / app/codeCharta/ui/toolBar/presentationModeButton presentationModeButton.component.ts

73.33% Statements 11/15
100% Branches 0/0
50% Functions 1/2
71.42% Lines 10/14

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 313x 3x 3x   3x 3x 3x                 3x 3x     3x 3x                    
import { Component, ElementRef } from "@angular/core"
import { MatSlideToggleChange, MatSlideToggle } from "@angular/material/slide-toggle"
import { Store } from "@ngrx/store"
import { CcState } from "../../../codeCharta.model"
import { setPresentationMode } from "../../../state/store/appSettings/isPresentationMode/isPresentationMode.actions"
import { isPresentationModeSelector } from "../../../state/store/appSettings/isPresentationMode/isPresentationMode.selector"
import { AsyncPipe } from "@angular/common"
 
@Component({
    selector: "cc-presentation-mode-button",
    templateUrl: "./presentationModeButton.component.html",
    styleUrls: ["./presentationModeButton.component.scss"],
    standalone: true,
    imports: [MatSlideToggle, AsyncPipe]
})
export class PresentationModeButtonComponent {
    isPresentationModeEnabled$ = this.store.select(isPresentationModeSelector)
 
    constructor(
        private readonly store: Store<CcState>,
        private elementReference: ElementRef
    ) {}
 
    setPresentationModeEnabled(event: MatSlideToggleChange) {
        this.store.dispatch(setPresentationMode({ value: event.checked }))
        this.elementReference.nativeElement.querySelector("mat-slide-toggle").classList.remove("cdk-focused")
        this.elementReference.nativeElement.querySelector("mat-slide-toggle").classList.remove("cdk-program-focused")
        this.elementReference.nativeElement.querySelector("mat-slide-toggle").classList.remove("mat-mdc-slide-toggle-focused")
    }
}