All files / src/BaseBar BaseSideBarItem.vue.js

62.5% Statements 5/8
62.5% Branches 5/8
100% Functions 1/1
62.5% Lines 5/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          1x                 1x     1x     1x 1x              
// @ts-check
 
import Vue from "vue";
import { isEmpty, startsWith } from "lodash";
 
const component = /** @type {V.Constructor<any, any>} */(Vue).extend({
  name: "BaseSideBarItem",
  props: {
    path: { type: String, default: "" },
    isActive: { type: Boolean, default: false },
    isDisabled: { type: Boolean, default: false }
  },
  computed: {
    active: function() {
      Iif (this.isDisabled) {
        return false;
      }
      else Iif (this.isActive || isEmpty(this.path)) {
        return this.isActive;
      }
      else Eif (this.path === "/") {
        return this.$route.path === this.path;
      }
      return startsWith(this.$route.path, this.path);
    }
  }
});
export default component;