All files / app/assets/javascripts/ide/components ide_file_row.vue

100% Statements 6/6
100% Branches 0/0
100% Functions 3/3
100% Lines 6/6

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          6x 6x 6x                             19x                 5x           113x                      
<script>
/**
 * This component is an iterative step towards refactoring and simplifying `vue_shared/components/file_row.vue`
 * https://gitlab.com/gitlab-org/gitlab/-/merge_requests/23720
 */
import { mapGetters } from 'vuex';
import FileRow from '~/vue_shared/components/file_row.vue';
import FileRowExtra from './file_row_extra.vue';
 
export default {
  name: 'IdeFileRow',
  components: {
    FileRow,
    FileRowExtra,
  },
  props: {
    file: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      dropdownOpen: false,
    };
  },
  computed: {
    ...mapGetters(['getUrlForPath']),
  },
  methods: {
    toggleDropdown(val) {
      this.dropdownOpen = val;
    },
  },
};
</script>
 
<template>
  <file-row
    :file="file"
    :file-url="getUrlForPath(file.path)"
    v-bind="$attrs"
    @mouseleave="toggleDropdown(false)"
    v-on="$listeners"
  >
    <file-row-extra :file="file" :dropdown-open="dropdownOpen" @toggle="toggleDropdown($event)" />
  </file-row>
</template>