All files / my/previewHeader previewHeader.js

100% Statements 9/9
100% Branches 8/8
100% Functions 6/6
100% Lines 8/8

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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54            3x   366x                                 75x 75x           75x       75x       450x           1x              
/*
 * Copyright (c) 2021, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
 */
import { LightningElement, api } from 'lwc';
 
export default class PreviewHeader extends LightningElement {
  @api
  filename;
 
  @api
  extension;
 
  @api
  prefix;
 
  @api
  type;
 
  @api
  selected;
 
  get className() {
    const tagClass = 'preview-header slds-vertical-tabs__nav-item';
    return this.selected === this.type
      ? `${tagClass} slds-is-active`
      : tagClass;
  }
 
  get tabIndex() {
    return this.selected === this.type ? '0' : '-1';
  }
 
  get isSelected() {
    return this.selected === this.type ? 'true' : 'false';
  }
 
  get fileName() {
    return `${this.prefix ? this.prefix : ''}${this.filename}.${
      this.extension
    }`;
  }
 
  onclickTab() {
    this.dispatchEvent(
      new CustomEvent('clicktab', {
        detail: this.extension
      })
    );
  }
}