All files / app/assets/javascripts/repository/pages blob.vue

40% Statements 2/5
100% Branches 0/0
20% Functions 1/5
40% Lines 2/5

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      3x                   17x                                                                  
<!-- eslint-disable vue/multi-word-component-names -->
<script>
// This file is in progress and behind a feature flag, please see the following issue for more:
// https://gitlab.com/gitlab-org/gitlab/-/issues/323200
 
import BlobContentViewer from '../components/blob_content_viewer.vue';
import { LIMITED_CONTAINER_WIDTH_CLASS } from '../constants';
 
export default {
  components: {
    BlobContentViewer,
  },
  beforeRouteEnter(to, from, next) {
    next(({ $options }) => {
      $options.limitedContainerElements.forEach((el) =>
        el.classList.remove(LIMITED_CONTAINER_WIDTH_CLASS),
      );
    });
  },
  beforeRouteLeave(to, from, next) {
    this.$options.limitedContainerElements.forEach((el) =>
      el.classList.add(LIMITED_CONTAINER_WIDTH_CLASS),
    );
    next();
  },
  props: {
    path: {
      type: String,
      required: true,
    },
    projectPath: {
      type: String,
      required: true,
    },
    refType: {
      type: String,
      required: false,
      default: null,
    },
  },
  limitedContainerElements: document.querySelectorAll(`.${LIMITED_CONTAINER_WIDTH_CLASS}`),
};
</script>
<template>
  <blob-content-viewer :path="path" :project-path="projectPath" :ref-type="refType" />
</template>