All files / src/components/u-navbar-multi.vue dropdown.vue

61.9% Statements 13/21
33.33% Branches 2/6
20% Functions 1/5
65% Lines 13/20

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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73      7x     7x                     7x                                                     7x 7x                                                      
<template>
<div :class="$style.root" :disabled="disabled">
    <div :class="$style.title"><slot name="title">{{ title }}</slot></div>
    <m-popper :class="$style.popper" :trigger="trigger" :placement="placement" :disabled="disabled" append-to="reference"
        :opened="opened" @update:opened="$emit('update:opened', $event)">
        <slot></slot>
    </m-popper>
</div>
</template>
 
<script>
export default {
    name: 'u-navbar-dropdown-multi',
    parentName: 'u-navbar-multi',
    props: {
        title: String,
        trigger: { type: String, default: 'hover' },
        placement: {
            type: String,
            default: 'bottom-start',
            validator: (value) =>
                /^(top|bottom|left|right)(-start|-end)?$/.test(value),
        },
        opened: { type: Boolean, default: false },
        disabled: { type: Boolean, default: false },
    },
};
</script>
 
<style module>
.root {
    display: inline-block;
    position: relative;
    z-index: 1;
    cursor: var(--cursor-pointer);
    height: var(--navbar-height);
    line-height: var(--navbar-height);
    border: none;
    padding: var(--navbar-dropdown-padding);
    font-size: var(--navbar-item-font-size);
    color: var(--navbar-color);
}
 
.root:not(:last-child) {
    margin-right: var(--navbar-item-space);
}

.root::after {
    position: absolute;
    icon-font: url('../i-icon.vue/icons/keyboard-arrow-down.svg');
    height: auto;
    line-height: var(--navbar-height);
    color: var(--navbar-color);
    font-size: 20px;
    right: 6px;
    top: 0;
}
 
.popper {
    background: var(--navbar-dropdown-popper-background);
    font-size: var(--navbar-dropdown-popper-font-size);
    width: 100%;
    line-height: var(--navbar-dropdown-popper-line-height);
    /* padding-top: 3px; */
    padding: var(--navbar-dropdown-popper-padding);
}
 
.root[disabled] {
    cursor: var(--cursor-not-allowed);
    color: var(--navbar-dropdown-color-disabled);
}
</style>