All files / app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue dropdown_contents.vue

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

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  20x   20x 20x                                   17x 1x   16x     25x 25x           138x                    
<script>
import { mapGetters, mapState } from 'vuex';
 
import DropdownContentsCreateView from './dropdown_contents_create_view.vue';
import DropdownContentsLabelsView from './dropdown_contents_labels_view.vue';
 
export default {
  components: {
    DropdownContentsLabelsView,
    DropdownContentsCreateView,
  },
  props: {
    renderOnTop: {
      type: Boolean,
      required: false,
      default: false,
    },
  },
  computed: {
    ...mapState(['showDropdownContentsCreateView']),
    ...mapGetters(['isDropdownVariantSidebar']),
    dropdownContentsView() {
      if (this.showDropdownContentsCreateView) {
        return 'dropdown-contents-create-view';
      }
      return 'dropdown-contents-labels-view';
    },
    directionStyle() {
      const bottom = this.isDropdownVariantSidebar ? '3rem' : '2rem';
      return this.renderOnTop ? { bottom } : {};
    },
  },
};
</script>
 
<template>
  <div
    class="labels-select-dropdown-contents gl-w-full gl-my-2 gl-py-3 gl-rounded-base gl-absolute"
    data-testid="labels-select-dropdown-contents"
    data-qa-selector="labels_dropdown_content"
    :style="directionStyle"
  >
    <component :is="dropdownContentsView" />
  </div>
</template>