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

uber / deck.gl / 13340

10 Sep 2019 - 3:13 coverage decreased (-2.6%) to 80.892%
13340

Pull #3552

travis-ci-com

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
[#3548 - Part 4] Modify setup.py to specify that README is markdown
Pull Request #3552: [#3548 - Part 4] Update notebook documentation to include additional pydeck features

3330 of 4491 branches covered (74.15%)

Branch coverage included in aggregate %.

6860 of 8106 relevant lines covered (84.63%)

5923.39 hits per line

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

97.56
/modules/core/src/transitions/transition-interpolator.js
1
import {equals} from 'math.gl';
8×
2
import assert from '../utils/assert';
3

4
export default class TransitionInterpolator {
5
  /**
6
   * @param opts {array|object}
7
   * @param opts.compare {array} - prop names used in equality check
8
   * @param opts.extract {array} - prop names needed for interpolation
9
   * @param opts.required {array} - prop names that must be supplied
10
   * alternatively, supply one list of prop names as `opts` if all of the above are the same.
11
   */
12
  constructor(opts = {}) {
13
    if (Array.isArray(opts)) {
24×
14
      opts = {
16×
15
        compare: opts,
16
        extract: opts,
17
        required: opts
18
      };
19
    }
20
    const {compare, extract, required} = opts;
24×
21

22
    this._propsToCompare = compare;
24×
23
    this._propsToExtract = extract;
24×
24
    this._requiredProps = required;
24×
25
  }
26

27
  /**
28
   * Checks if two sets of props need transition in between
29
   * @param currentProps {object} - a list of viewport props
30
   * @param nextProps {object} - a list of viewport props
31
   * @returns {bool} - true if two props are equivalent
32
   */
33
  arePropsEqual(currentProps, nextProps) {
34
    for (const key of this._propsToCompare || Object.keys(nextProps)) {
71×
35
      if (!equals(currentProps[key], nextProps[key])) {
154×
36
        return false;
46×
37
      }
38
    }
39
    return true;
25×
40
  }
41

42
  /**
43
   * Called before transition starts to validate/pre-process start and end props
44
   * @param startProps {object} - a list of starting viewport props
45
   * @param endProps {object} - a list of target viewport props
46
   * @returns {Object} {start, end} - start and end props to be passed
47
   *   to `interpolateProps`
48
   */
49
  initializeProps(startProps, endProps) {
50
    let result;
51

52
    if (this._propsToExtract) {
48×
53
      const startViewStateProps = {};
46×
54
      const endViewStateProps = {};
46×
55

56
      for (const key of this._propsToExtract) {
46×
57
        startViewStateProps[key] = startProps[key];
180×
58
        endViewStateProps[key] = endProps[key];
180×
59
      }
60
      result = {start: startViewStateProps, end: endViewStateProps};
46×
61
    } else {
62
      result = {start: startProps, end: endProps};
2×
63
    }
64

65
    this._checkRequiredProps(result.start);
48×
66
    this._checkRequiredProps(result.end);
45×
67

68
    return result;
45×
69
  }
70

71
  /**
72
   * Returns viewport props in transition
73
   * @param startProps {object} - a list of starting viewport props
74
   * @param endProps {object} - a list of target viewport props
75
   * @param t {number} - a time factor between [0, 1]
76
   * @returns {object} - a list of interpolated viewport props
77
   */
78
  interpolateProps(startProps, endProps, t) {
UNCOV
79
    assert(false, 'interpolateProps is not implemented');
!
80
  }
81

82
  _checkRequiredProps(props) {
83
    if (!this._requiredProps) {
93×
84
      return;
4×
85
    }
86

87
    this._requiredProps.forEach(propName => {
89×
88
      const value = props[propName];
329×
89
      assert(
329×
90
        Number.isFinite(value) || Array.isArray(value),
91
        `${propName} is required for transition`
92
      );
93
    });
94
  }
95
}
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