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

100% Statements 7/7
83.33% Branches 5/6
100% Functions 2/2
100% Lines 7/7

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  20x 20x                                 2x 2x     2x 1x             108x                      
<script>
import { GlButton, GlIcon } from '@gitlab/ui';
import { mapActions, mapGetters } from 'vuex';
 
export default {
  components: {
    GlButton,
    GlIcon,
  },
  computed: {
    ...mapGetters([
      'dropdownButtonText',
      'isDropdownVariantStandalone',
      'isDropdownVariantEmbedded',
    ]),
  },
  methods: {
    ...mapActions(['toggleDropdownContents']),
    handleButtonClick(e) {
E      if (this.isDropdownVariantStandalone || this.isDropdownVariantEmbedded) {
        this.toggleDropdownContents();
      }
 
      if (this.isDropdownVariantStandalone) {
        e.stopPropagation();
      }
    },
  },
};
</script>
 
<template>
  <gl-button
    class="labels-select-dropdown-button js-dropdown-button w-100 text-left"
    @click="handleButtonClick"
  >
    <span class="dropdown-toggle-text gl-pointer-events-none flex-fill">
      {{ dropdownButtonText }}
    </span>
    <gl-icon name="chevron-down" class="gl-pointer-events-none float-right" />
  </gl-button>
</template>