• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uiv-lib / uiv / 7601639902

21 Jan 2024 01:46PM UTC coverage: 86.79%. Remained the same
7601639902

Pull #837

github

web-flow
chore(deps): update dependency vitepress to v1.0.0-rc.39
Pull Request #837: chore(deps): update dependency vitepress to v1.0.0-rc.39

859 of 1065 branches covered (0.0%)

Branch coverage included in aggregate %.

1539 of 1698 relevant lines covered (90.64%)

184.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.38
/src/directives/tooltip/tooltip.js
1
import { h, render } from 'vue';
2
import Tooltip from '../../components/tooltip/Tooltip.vue';
3
import { hasOwnProperty } from '../../utils/object.utils';
4
import { removeFromDom } from '../../utils/dom.utils';
5

6
const INSTANCE = '_uiv_tooltip_instance';
27✔
7

8
const mounted = (el, binding) => {
27✔
9
  // console.log('bind')
10
  unmounted(el);
22✔
11
  const options = [];
22✔
12
  for (const key in binding.modifiers) {
22✔
13
    if (hasOwnProperty(binding.modifiers, key) && binding.modifiers[key]) {
14!
14
      options.push(key);
14✔
15
    }
16
  }
17
  let placement, trigger, enterable;
18
  options.forEach((option) => {
22✔
19
    if (/(top)|(left)|(right)|(bottom)/.test(option)) {
14✔
20
      placement = option;
4✔
21
    } else if (/(hover)|(focus)|(click)/.test(option)) {
10✔
22
      trigger = option;
8✔
23
    } else if (/unenterable/.test(option)) {
2!
24
      enterable = false;
×
25
    }
26
  });
27

28
  const vNode = h(Tooltip, {
22✔
29
    target: el,
30
    appendTo: binding.arg && '#' + binding.arg,
32✔
31
    text:
32
      typeof binding.value === 'string'
22!
33
        ? binding.value && binding.value.toString()
44✔
34
        : binding.value && binding.value.text && binding.value.text.toString(),
×
35
    positionBy:
36
      binding.value &&
44!
37
      binding.value.positionBy &&
38
      binding.value.positionBy.toString(),
39
    viewport:
40
      binding.value &&
44!
41
      binding.value.viewport &&
42
      binding.value.viewport.toString(),
43
    customClass:
44
      binding.value &&
44!
45
      binding.value.customClass &&
46
      binding.value.customClass.toString(),
47
    showDelay: binding.value && binding.value.showDelay,
44✔
48
    hideDelay: binding.value && binding.value.hideDelay,
44✔
49
    enterable,
50
    placement,
51
    trigger,
52
  });
53
  const container = document.createElement('div');
22✔
54
  render(vNode, container);
22✔
55
  el[INSTANCE] = { container, vNode };
22✔
56
};
57

58
const unmounted = (el) => {
27✔
59
  // console.log('unbind', el[INSTANCE])
60
  const instance = el[INSTANCE];
42✔
61
  if (instance) {
42✔
62
    try {
22✔
63
      removeFromDom(instance.vNode.component.ctx.$refs.popup);
22✔
64
    } catch (_) {}
65
    render(null, instance.container);
22✔
66
  }
67
  delete el[INSTANCE];
42✔
68
};
69

70
const updated = (el, binding) => {
27✔
71
  // console.log('update', binding.oldValue, '->', binding.value)
72
  if (binding.value !== binding.oldValue) {
21✔
73
    mounted(el, binding);
2✔
74
  }
75
};
76

77
export default { mounted, unmounted, updated };
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc