All files / menu si-menu-bar.directive.ts

100% Statements 4/4
50% Branches 1/2
100% Functions 1/1
100% Lines 4/4

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                                1x 29x       175x           29x    
/**
 * Copyright (c) Siemens 2016 - 2025
 * SPDX-License-Identifier: MIT
 */
import { CdkMenuBar, CdkTargetMenuAim } from '@angular/cdk/menu';
import { Directive, HostBinding, inject, input } from '@angular/core';
 
@Directive({
  // eslint-disable-next-line @angular-eslint/directive-selector
  selector: 'si-menu-bar',
  host: {
    class: 'd-inline-flex',
    style: 'gap: 1px'
  },
  hostDirectives: [CdkMenuBar, CdkTargetMenuAim]
})
export class SiMenuBarDirective {
  private menuBar = inject(CdkMenuBar, { self: true });
 
  @HostBinding('tabindex')
  protected get tabIndex(): 0 | -1 | null {
    return this.disabled() ? -1 : this.menuBar._getTabIndex();
  }
 
  /**
   * Sets the menu-bar disabled, i.e. sets tabindex="-1"
   */
  readonly disabled = input<boolean>();
}