Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Sign In

uber / deck.gl / 13873

19 Sep 2019 - 20:02 coverage increased (+2.8%) to 82.702%
13873

Pull #3639

travis-ci-com

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
Update
Pull Request #3639: Set default pydeck notebook width to 700px

3398 of 4611 branches covered (73.69%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

488 existing lines in 85 files now uncovered.

7192 of 8194 relevant lines covered (87.77%)

4273.96 hits per line

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

6.0
/modules/jupyter-widget/src/widget-tooltip.js
1
/* global document */
2
let lastPickedObject;
3
let lastTooltip;
4

5
export default function getTooltip(pickedInfo) {
6
  if (!pickedInfo.picked) {
Branches [[0, 0], [0, 1]] missed. 1×
7
    return null;
2×
8
  }
9
  if (pickedInfo.object === lastPickedObject) {
Branches [[1, 0], [1, 1]] missed. !
10
    return lastTooltip;
!
11
  }
12
  const tooltip = {
!
13
    html: tabularize(pickedInfo.object),
14
    style: {
15
      fontFamily: '"Helvetica Neue", Helvetica, Arial, sans-serif',
16
      display: 'flex',
17
      flex: 'wrap',
18
      maxWidth: '500px',
19
      flexDirection: 'column',
20
      zIndex: 2
21
    }
22
  };
23
  lastTooltip = tooltip;
!
24
  lastPickedObject = pickedInfo.object;
!
25
  return tooltip;
!
26
}
27

UNCOV
28
const EXCLUDES = new Set(['position', 'index']);
!
29

30
function tabularize(json) {
31
  // Turns a JSON object of picked info into HTML for a tooltip
32
  const dataTable = document.createElement('div');
!
33
  dataTable.className = 'dataTable';
1×
34

35
  // Creates rows of two columns for the tooltip
36
  for (const key in json) {
!
37
    if (EXCLUDES.has(key)) {
Branches [[2, 0], [2, 1]] missed. !
38
      continue; // eslint-disable-line
!
39
    }
40
    const header = document.createElement('div');
!
41
    header.className = 'header';
!
42
    header.innerText = key;
!
43

44
    const valueElement = document.createElement('div');
!
45
    valueElement.className = 'value';
!
46

47
    valueElement.innerText = toText(json[key]);
!
48

49
    const row = document.createElement('div');
!
50

51
    setStyles(row, header, valueElement);
!
52

53
    row.appendChild(header);
!
54
    row.appendChild(valueElement);
!
55
    dataTable.appendChild(row);
!
56
  }
57
  return dataTable.innerHTML;
!
58
}
59

60
function setStyles(row, header, value) {
61
  // Set default tooltip style
62
  Object.assign(header.style, {
!
63
    fontWeight: 700,
64
    marginRight: '10px',
65
    flex: 1
66
  });
67

68
  Object.assign(value.style, {
!
69
    flex: 'none',
70
    maxWidth: '250px',
71
    overflow: 'hidden',
72
    whiteSpace: 'nowrap',
73
    textOverflow: 'ellipsis'
74
  });
75

76
  Object.assign(row.style, {
!
77
    display: 'flex',
78
    flexDirection: 'row',
79
    justifyContent: 'space-between',
80
    alignItems: 'stretch'
81
  });
82
}
83

84
function toText(jsonValue) {
85
  // Set contents of table value, trimming for certain types of data
86
  let text;
87
  if (Array.isArray(jsonValue) && jsonValue.length > 4) {
Branches [[3, 0], [3, 1], [4, 0], [4, 1]] missed. !
88
    text = `Array<${jsonValue.length}>`;
!
89
  } else {
90
    try {
!
91
      text = JSON.stringify(jsonValue);
!
92
    } catch (err) {
93
      text = '<Non-Serializable Object>';
!
94
    }
95
  }
96
  const MAX_LENGTH = 50;
!
97
  if (text.length > MAX_LENGTH) {
Branches [[5, 0], [5, 1]] missed. !
98
    text = text.slice(0, MAX_LENGTH);
!
99
  }
100
  return text;
!
101
}
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
BLOG · TWITTER · Legal & Privacy · Supported CI Services · What's a CI service? · Automated Testing

© 2019 Coveralls, LLC